move record state to vars, support removal
This commit is contained in:
parent
0e6228b751
commit
2d4dc4ac48
4 changed files with 14 additions and 13 deletions
|
@ -1,16 +1,15 @@
|
|||
---
|
||||
|
||||
- name: "create records ({{domain}})"
|
||||
- name: "manage records for ({{ domain }})"
|
||||
cloudflare_dns:
|
||||
zone: "{{ domain }}"
|
||||
record: "{{ record.name }}"
|
||||
value: "{{ record.value }}"
|
||||
type: "{{ record.type }}"
|
||||
solo: yes
|
||||
state: present
|
||||
solo: "{{ 'yes' if record.state in ['present'] | default(false) else omit }}"
|
||||
state: "{{ record.state }}" # don't assume / set a default, require explicit instruction
|
||||
account_email: "{{ cf_email }}"
|
||||
account_api_token: "{{ cf_token }}"
|
||||
loop: "{{ records }}"
|
||||
loop_control:
|
||||
loop_var: record
|
||||
when: (item.state is undefined) or (not item.state == 'absent')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue