forked from topher23/Puppet_Module_Development
-
Notifications
You must be signed in to change notification settings - Fork 1
Ansible Getting Started
Alexandru Zbarcea edited this page Feb 28, 2015
·
1 revision
yaourt python-pip ansible
export WK_DIR=~/projects/ansible-getting-started
mkdir $WK_DIR
cd $WK_DIR
$ vi hosts
[sites]
127.0.0.1
192.168.0.1
192.168.0.2
192.168.0.3
# ~/setup/playbook.yml
- hosts: 127.0.0.1
user: root
tasks:
- name: git
pacman: pkg=git state=present
- name: start docker every bootup
service: name=docker state=started enabled=yes
- name: do something in the shell
shell: echo hello > /tmp/abc.txt
$ ls
hosts
playbook.yml
$ ansible-playbook -i hosts playbook.yml
PLAY [127.0.0.1] **************************************************************
GATHERING FACTS ***************************************************************
ok: [127.0.0.1]
TASK: [git] *******************************************************************
ok: [127.0.0.1]
TASK: [start docker every bootup] *********************************************
ok: [127.0.0.1]
TASK: [do something in the shell] *********************************************
changed: [127.0.0.1]
PLAY RECAP ********************************************************************
127.0.0.1 : ok=4 changed=1 unreachable=0 failed=0