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

30 lines
1.1 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-05-12 20:23:53 +00:00
delegate_to: "{{ corenetworks_dns_delegate_to }}"
2020-05-12 19:57:32 +00:00
- name: Create DNS records
corenetworks_dns:
api_token: "{{ __corenetworks.session.token }}"
zone: "{{ item.zone | default('corenetworks_dns_default_zone') }}"
record: "{{ item.record | default(omit) }}"
type: "{{ item.type | default(omit) }}"
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 10:58:25 +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 }}"