Ansible

The follow ansible examples were tested on 1.3.3.

Ansible Inventory Examples

Check out ansible’s inventory documentation for more info.

sample-inventory.txt

[centos6]
server1-el6

[centos5withepel]
server2-el5

[centos5withoutepel]
server3-el5 ansible_python_interpreter=/usr/bin/python26

[unixservers]
server4-unix

[nonstandardsshport]
server5:1234
server6:4321
server7 ansible_ssh_port=12345

Ansible Playbook Examples

See ansible’s playbook documentation for more info.

sample-copy-playbook.yaml

- hosts: all
  sudo: yes
  gather_facts: True
  task:
  - name: Copy hosts file to remote server
    copy: src=/home/user/hosts dest=/etc/hosts owner=root group=root mode=755
  - name: Copy known hosts file
    copy: src=/home/user/.ssh/known_hosts dest=/home/user/.ssh/known_hosts owner=user group=use mode=600

Ansible Command Line Examples

Leave a Reply

Your email address will not be published. Required fields are marked *