On 26.01.17 08:28 rene via Ansible Project wrote:

> As of now, I have a playbook wich is split up into smaller .yml
> files. The reason for that is, that we want to "re-use" some of
> .yml files in other playbooks so we don't have to rewrite
> everything from scratch as we progress.

I would try to get familiar with using roles rather than including
yml-files. Easier (for me) and less error prone.

https://docs.ansible.com/playbooks_roles.html

> delegate_to: "{{ groups.launched[0] }}"

Rather than targetting localhost at the beginning and then delegating
everything to hosts, I would try to work the other way.

Side note:
I have only "hosts: {{ target }}" in my playbooks, that way I can
decide on the command line, which hosts to target by using
"ansible-playbook some.yml -e 'target=foobar'".

> The issue I have with this is, that I want to re-use this part with
> a bunch of other playbooks. But not every other type of server
> needs packages removed or need packages from backports.

Add a when condition to only execute the task, if e.g. your variable
aptpackages is defined
when: 'aptpackages is defined'
(indentation equal to the name or apt lines)

Johannes

-- 
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-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/69a2a0b3-5a57-5ee5-97fa-89fa0d486a44%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to