This repository has been archived on 2022-06-20. You can view files and clone it, but cannot push or open issues or pull requests.
xoxys.corenetworks_dns/tasks/setup.yml
Robert Kaussow 675f4db8f5
All checks were successful
continuous-integration/drone/push Build is passing
add option to obtain api token only once
2020-06-23 22:07:03 +02:00

33 lines
1.3 KiB
YAML

---
- name: Install dependencies
pip:
name: "{{ item }}"
executable: "{{ corenetworks_dns_pip }}"
extra_args: --user
state: present
loop: "{{ corenetworks_dns_python_packages }}"
delegate_to: "{{ corenetworks_dns_delegate_to }}"
- 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
when: corenetworks_dns_token is not defined
delegate_to: "{{ corenetworks_dns_delegate_to }}"
run_once: "{{ corenetworks_dns_token_run_once }}"
- name: Create DNS records
corenetworks_dns:
api_token: "{{ corenetworks_dns_token if corenetworks_dns_token is defined else __corenetworks.session.token }}"
zone: "{{ item.zone | default(corenetworks_dns_default_zone) }}"
record: "{{ item.record | default(omit) }}"
type: "{{ item.type | default(omit) }}"
solo: "{{ item.solo | default(omit) }}"
value: "{{ item.value | default(omit) }}"
state: "{{ item.state | default('present') }}"
loop: "{{ corenetworks_dns_records + corenetworks_dns_records_extra }}"
loop_control:
label: "{{ item.zone | default(corenetworks_dns_default_zone) }}:{{ item.record | default('@') }}"
delegate_to: "{{ corenetworks_dns_delegate_to }}"