xoxys.cloudflare_dns/tasks/setup.yml

33 lines
1.3 KiB
YAML
Raw Normal View History

2020-05-12 19:57:32 +00:00
---
2020-05-13 09:26:17 +00:00
- name: Install dependencies
pip:
name: "{{ item }}"
executable: "{{ corenetworks_dns_pip }}"
extra_args: --user
state: present
loop: "{{ corenetworks_dns_python_packages }}"
2020-05-13 10:08:31 +00:00
delegate_to: "{{ corenetworks_dns_delegate_to }}"
2020-05-13 09:26:17 +00:00
2020-05-12 19:57:32 +00:00
- name: Obtain an API token
corenetworks_token:
api_user: "{{ corenetworks_dns_api_user | default(omit) }}"
api_password: "{{ corenetworks_dns_api_password | default(omit) }}"
register: __corenetworks
2020-06-23 19:53:05 +00:00
when: corenetworks_dns_token is not defined
2020-05-12 20:23:53 +00:00
delegate_to: "{{ corenetworks_dns_delegate_to }}"
run_once: "{{ corenetworks_dns_token_run_once }}"
2020-05-12 19:57:32 +00:00
- name: Create DNS records
corenetworks_dns:
2020-06-23 19:53:05 +00:00
api_token: "{{ corenetworks_dns_token if corenetworks_dns_token is defined else __corenetworks.session.token }}"
2020-05-13 11:03:53 +00:00
zone: "{{ item.zone | default(corenetworks_dns_default_zone) }}"
2020-05-12 19:57:32 +00:00
record: "{{ item.record | default(omit) }}"
type: "{{ item.type | default(omit) }}"
2020-05-22 19:57:24 +00:00
solo: "{{ item.solo | default(omit) }}"
2020-05-12 19:57:32 +00:00
value: "{{ item.value | default(omit) }}"
state: "{{ item.state | default('present') }}"
2020-05-13 10:55:08 +00:00
loop: "{{ corenetworks_dns_records + corenetworks_dns_records_extra }}"
2020-05-12 19:57:32 +00:00
loop_control:
2020-05-13 11:03:53 +00:00
label: "{{ item.zone | default(corenetworks_dns_default_zone) }}:{{ item.record | default('@') }}"
2020-05-12 20:23:53 +00:00
delegate_to: "{{ corenetworks_dns_delegate_to }}"