General

Conditionals and Return Status

 

Formatting

 

Break long lines using yaml line continuation.

Reference: http://docs.ansible.com/playbooks_intro.html

  - file: dest="{{ test }}" src="./foo.txt" mode=0077 state=present user="root" group="wheel"
- file: >
	dest="{{ test }}"
	src="./foo.txt"
	mode=0077
	state=present
	user="root"
	group="wheel"
  - file:
      dest: "{{ test }}"
	  src: "./foo.txt"
	  mode: 0077 
	  state: present
	  user: "root"
	  group: "wheel"

Roles

Role Variables

Role Naming Conventions

Secure vs. Insecure data

As a general policy we want to protect the following data:

Directory structure for the secure repository:


ansible
├── files
├── keys
└── vars

The default secure_dir is set in group_vars/all and can be overridden by adding another file in group_vars that corresponds to a deploy group name.

For templates or files that are secure use first_available_file, example:

- name: xserver | install read-only ssh key for the content repo that is required for grading
  copy: src={{ item }} dest=/etc/git-identity force=yes owner=ubuntu group=adm mode=60
  first_available_file:
    - "{{ secure_dir }}/files/git-identity"
    - "git-identity-example"