Merge branch 'master' of /git/ansible
This commit is contained in:
commit
5cbe27174f
5 changed files with 73 additions and 0 deletions
21
playbooks/playlet-test.yml
Normal file
21
playbooks/playlet-test.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# requires --extra-vars="target='host1;host2;group etc'
|
||||||
|
|
||||||
|
- name: run a playley
|
||||||
|
hosts: $target
|
||||||
|
user: root
|
||||||
|
gather_facts: false
|
||||||
|
vars_files:
|
||||||
|
- /srv/web/infra/ansible/vars/global.yml
|
||||||
|
- $private/vars.yml
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: populate my target group
|
||||||
|
action: add_host groupname=parent_group hostname=$item
|
||||||
|
with_items: $hosts
|
||||||
|
|
||||||
|
- include: $basedir/playlets/test/book.yml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
36
playlets/README
Normal file
36
playlets/README
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
playlets are self-contained playbooks which are never intended to be
|
||||||
|
directly executed. They are only to be used as an 'include' from our other
|
||||||
|
playbooks.
|
||||||
|
|
||||||
|
All of these playbooks must have:
|
||||||
|
|
||||||
|
|
||||||
|
hosts: $parent_group
|
||||||
|
|
||||||
|
the general structure is:
|
||||||
|
|
||||||
|
playlet_name/
|
||||||
|
vars/vars.yml
|
||||||
|
files/myfile.conf
|
||||||
|
myfile2.conf.j2
|
||||||
|
handlers/handlers.yml
|
||||||
|
book.yml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template for book.yml
|
||||||
|
---
|
||||||
|
- name: give the play let a name
|
||||||
|
hosts: $parent_group
|
||||||
|
tags:
|
||||||
|
- playlet_tag_name
|
||||||
|
vars_files:
|
||||||
|
- vars/somefile.yml
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: my task
|
||||||
|
action: stuff which I do
|
||||||
|
|
||||||
|
|
||||||
|
|
12
playlets/test/book.yml
Normal file
12
playlets/test/book.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
- name: test playlet
|
||||||
|
hosts: parent_group
|
||||||
|
tags:
|
||||||
|
- playlet_tag_name
|
||||||
|
vars_files:
|
||||||
|
- vars/vars.yml
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: my task 1
|
||||||
|
action: copy src=files/${myfile} dest=/tmp/${myfile}.txt
|
||||||
|
|
2
playlets/test/files/foo
Normal file
2
playlets/test/files/foo
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
this is foo
|
||||||
|
it should end up in /tmp
|
2
playlets/test/vars/vars.yml
Normal file
2
playlets/test/vars/vars.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
---
|
||||||
|
myfile: foo
|
Loading…
Add table
Add a link
Reference in a new issue