mirror of https://github.com/ansible/ansible.git
Drastically simply playbook syntax
parent
136d8fa33a
commit
f7cff27f3d
@ -1,33 +1,19 @@
|
|||||||
- pattern: '*'
|
- pattern: '*'
|
||||||
hosts: /etc/ansible/hosts
|
hosts: /etc/ansible/hosts
|
||||||
tasks:
|
tasks:
|
||||||
- do:
|
- name: config step
|
||||||
- configure template & module variables for future template calls
|
action: setup a=2 b=3 c=4
|
||||||
- setup a=2 b=3 c=4
|
- name: copy comand
|
||||||
- do:
|
action: copy src=/srv/a dest=/srv/b
|
||||||
- copy a file from the local disk to the remote
|
|
||||||
- copy src=/srv/a dest=/srv/b
|
|
||||||
notify:
|
notify:
|
||||||
- restart apache
|
- restart apache
|
||||||
- do:
|
- name: template step
|
||||||
- template from local file template.j2 to remote location /srv/file.out
|
action: template src=/srv/template.j2 dest=/srv/file.out
|
||||||
- template src=/srv/template.j2 dest=/srv/file.out
|
|
||||||
notify:
|
notify:
|
||||||
- restart apache
|
- restart apache
|
||||||
- quack like a duck
|
- name: execute bin false
|
||||||
- do:
|
comment: call something that will fail just to demo failure counts and such
|
||||||
- if running as non-root whne you template, you should specify the MD file (1)
|
action: command /bin/false
|
||||||
- setup a=3 b=4 c=5 metadata=/tmp/metadata.json
|
|
||||||
- do:
|
|
||||||
- if running as non-root when you template, you should specify the MD file (2)
|
|
||||||
- template src=/srv/template.j2 dest=/srv/file2.out metadata=/tmp/metadata.json
|
|
||||||
- do:
|
|
||||||
- call something that will fail just to demo failure counts and such
|
|
||||||
- command /bin/false
|
|
||||||
handlers:
|
handlers:
|
||||||
- do:
|
- name: restart apache
|
||||||
- restart apache
|
action: service name=httpd ensure=restarted
|
||||||
- service name=httpd ensure=restarted
|
|
||||||
- do:
|
|
||||||
- quack like a duck
|
|
||||||
- command /bin/true
|
|
||||||
|
|||||||
Loading…
Reference in New Issue