On Friday, 23 March 2018 15.43.59 CET Simon Weald wrote:
> creation of these is easy using the create playbook here:
> https://gist.github.com/analbeard/cb5913abfc6101b4eef88674853f3c16
>
>
> However deletion is problematic. If you use the delete playbook at that
> link, the first task will succeed and then the rest will fail due to to the
> fact that the zone deletion also removes everything inside the zone
> (domains and records). So, my question really is how would you expect that
> to function? I can see some ways around this.
>
>
>
> - I could add a force flag to the zone module which will only remove a
> zone which is completely empty of domains/records if it isn't set tot
> true,
> however in which case how should I handle attempted deletion of a zone
> with
> contents but without force? Fail hard? Do nothing?
It's a good idea to make sure the user don't shoot them self in the foot.
I think you should fail with return code 1 (or some other code), then the user
could use failed_when: to ignore it like this
- name: delete zone
memset_zone
api_key: 0e0afa4165b141479ed07505991a223d
state: absent
name: testzone
register: result
failed_when: result.rc < 2
> - I could allow the zone deletion to occur but then have the zone domain
> / zone record modules just pass successfully if the zone they're supposed
> to be in doesn't exist?
This is the best solution, they are absent just like the user want and should
be successful.
--
Kai Stian Olstad
--
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/29844886.02ScOJgI04%40x1.
For more options, visit https://groups.google.com/d/optout.