test using a list of records
This commit is contained in:
21
README.md
21
README.md
@@ -1,4 +1,4 @@
|
|||||||
Role Name
|
Rôles Name
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Add or remove dns records
|
Add or remove dns records
|
||||||
@@ -16,9 +16,10 @@ ovh_api_application_key
|
|||||||
ovh_api_application_secret
|
ovh_api_application_secret
|
||||||
ovh_api_consumer_key
|
ovh_api_consumer_key
|
||||||
|
|
||||||
record_name
|
dns_records:
|
||||||
record_value
|
- record_name
|
||||||
record_type
|
record_value
|
||||||
|
record_type
|
||||||
dns_action: delete or add
|
dns_action: delete or add
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
@@ -29,9 +30,17 @@ Example Playbook
|
|||||||
|
|
||||||
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
|
||||||
|
|
||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
|
vars:
|
||||||
|
dns_records:
|
||||||
|
- record_name: foobar.opendoor.fr
|
||||||
|
record_value: 1.2.3.4
|
||||||
|
record_type: "A"
|
||||||
|
- record_name: plop.opendoor.fr
|
||||||
|
record_value: foobar.opendoor.fr.
|
||||||
|
record__type: CNAME
|
||||||
roles:
|
roles:
|
||||||
- { role: tco.dns, record_name: "foobar.opendoor.fr", record_value: "1.2.3.43, record_type: 'A', dns_action: 'add' }
|
- { role: tco.dns, dns_records: {{ dns_records }}" }
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
# tasks file for tco.dns
|
# tasks file for tco.dns
|
||||||
|
|
||||||
- name: manage dns record
|
- name: manage dns record
|
||||||
vars:
|
vars:
|
||||||
state: "{{ (dns_action == 'delete' ) | ternary( 'absent', 'present' ) }}"
|
state: "{{ (dns_action == 'delete' ) | ternary( 'absent', 'present' ) }}"
|
||||||
@@ -9,8 +10,8 @@
|
|||||||
ovh_api_application_secret: "{{ ovh_api_application_secret }}"
|
ovh_api_application_secret: "{{ ovh_api_application_secret }}"
|
||||||
ovh_api_consumer_key: "{{ ovh_api_consumer_key }}"
|
ovh_api_consumer_key: "{{ ovh_api_consumer_key }}"
|
||||||
zone: "{{ dns_zone }}"
|
zone: "{{ dns_zone }}"
|
||||||
record_name: "{{ record_name }}"
|
record_name: "{{ item.record_name }}"
|
||||||
record_value: "{{ record_value }}"
|
record_value: "{{ item.record_value }}"
|
||||||
record_type: "{{ record_type }}"
|
record_type: "{{ item.record_type }}"
|
||||||
state: "{{ state }}"
|
state: "{{ state }}"
|
||||||
|
loop: "{{ dns_records }}"
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
- hosts: localhost
|
||||||
remote_user: root
|
vars:
|
||||||
|
records:
|
||||||
|
- record_name: test1
|
||||||
|
record_value: 1.2.3.4
|
||||||
|
record_type: "A"
|
||||||
|
- record_name: test2
|
||||||
|
record_value: foobar.opendoor.fr.
|
||||||
|
record_type: CNAME
|
||||||
roles:
|
roles:
|
||||||
- tco.dns
|
- { role: tco.dns, dns_action: "delete", dns_records: "{{ records }}" }
|
||||||
Reference in New Issue
Block a user