on/off playooks for lots of resources w/o repeating them (minimal redundancy)

25 views
Skip to first unread message

Frank Thommen

unread,
Jul 11, 2016, 3:21:12 AM7/11/16
to Ansible Project
Hi,

I'm currently evaluating ansible as a candidate for our future CM tool.
I'm stuck with the issue, that we have "blocks" of resources (e.g. a
list of around 30 NFS mounts) which we'd like to be able to switch on
and off w/o repeating the complete resources in two playbooks. How can
we have two playbooks, one mounting the mounts, the other unmounting
them w/o having to duplicate the whole list in both playbooks?

I'm sure there is a way, I just dont seem to be able to find the
appropriate documentation page.

Any pointer is appreciated
frank


J Hawkesworth

unread,
Jul 11, 2016, 5:42:55 AM7/11/16
to Ansible Project
I can think of a couple of ways - there are probably more

One way would be by having both playbooks include a vars file which has the list of mounts in it:


or you could add the list of mounts to a group variable and have it apply to both playbooks by having both playbooks work against that group of hosts


Hope this helps,

Jon

Frank Thommen

unread,
Jul 11, 2016, 1:42:03 PM7/11/16
to ansible...@googlegroups.com
Thanks a lot. I'll give these a try.
frank
> --
> You received this message because you are subscribed to the Google
> Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to ansible-proje...@googlegroups.com
> <mailto:ansible-proje...@googlegroups.com>.
> To post to this group, send email to ansible...@googlegroups.com
> <mailto:ansible...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/d22afed3-6f07-412e-9cc5-03dd5c019c5d%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/d22afed3-6f07-412e-9cc5-03dd5c019c5d%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages