You might want to look at
http://docs.ansible.com/playbooks_loops.html#looping-over-hashes, where you
could create a dictionary structure like:
my_dbs:
db1:
state: present
db2:
state: absent
And your task could look like this:
- name: add/remove databases
whatever_db_module: name={{item.key}} state={{item.value.state}}
with_dict: my_dbs
On Tue, Apr 22, 2014 at 11:28 AM, Yoann DAVID <[email protected]> wrote:
> I want to create a playbook to create but also delete databases that are
> not anymore in my configuration file.
>
> Lets take an example, I have a variable listing database to create :
>
> db:
> - foo
> - bar
>
> First run DB foo and bar are created, if I remove bar from my list, when I
> run ansible bar is always in my server.
>
> I would find a solution to address the deletion of a previously added db
> but not available anymore.
>
> Somewhere something like this playbook (for users) :
> https://github.com/jurgenhaas/ansible-user-management
>
> Any idea to deal with this problem ?
> How do you deal with resources added then removed to delete them on server
> ?
>
> Create a temporary playbook to explicitly remove the resources ?
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/a4c54e48-61a1-4aef-a5cd-588cb09b512a%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/a4c54e48-61a1-4aef-a5cd-588cb09b512a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAMFyvFgiDz8Q-3cnpjy2SdOS8bQ7%2BzEwUHYZ7%2B%2B%3D%3DEmAJoTnaQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.