On Friday, 23 March 2018 17.29.08 CET Kai Stian Olstad wrote:
> 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