A smattering of frequently used commands I use. This will help prevent excessive load on Google's systems.
NOTE: most examples are copied and pasted from the documentation. Attribution belongs to the contributors of the documentation!
http://docs.ansible.com/ansible/latest/template_module.html
- template:
src: /mytemplates/foo.j2
dest: /etc/file.conf
owner: bin
group: wheel
mode: 0644
http://docs.ansible.com/ansible/latest/lineinfile_module.html
- lineinfile:
path: /tmp/testfile
line: '192.168.1.99 foo.lab.net foo'
insertafter: EOF
http://docs.ansible.com/ansible/latest/file_module.html
- file:
path: /etc/foo.conf
owner: foo
group: foo
mode: 0644
# create a directory if it doesn't exist
- file:
path: /etc/some_directory
state: directory
mode: 0755
# Add the user 'james' with a bash shell, appending the group 'admins' and 'developers' to the user's groups
- user:
name: james
shell: /bin/bash
groups: admins,developers
append: yes
- name: install packages
apt:
name: "{{item}}"
state: latest
update_cache: yes
install_recommends: yes
with_items:
- zsh
- git
- vim
- tmux
- curl
- postgresql-client-common
- openssh-server
- net-tools
become: yes
become_method: sudo
http://docs.ansible.com/ansible/latest/git_module.html
- git:
repo: 'https://foosball.example.org/path/to/repo.git'
dest: /srv/checkout
version: release-0.22