Compare commits
9 Commits
8270ba251c
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| c3e41a3427 | |||
| d7b1584b9f | |||
| e2835676ad | |||
| 6d0c01eee7 | |||
| 53ce83859e | |||
| 461d255e6b | |||
| afc47dcaf8 | |||
| 1377468c37 | |||
| 16430c1e2b |
30
README.md
30
README.md
@@ -1,4 +1,4 @@
|
||||
Role Name
|
||||
Rôles Name
|
||||
=========
|
||||
|
||||
Add or remove dns records
|
||||
@@ -16,10 +16,11 @@ ovh_api_application_key
|
||||
ovh_api_application_secret
|
||||
ovh_api_consumer_key
|
||||
|
||||
record_name
|
||||
record_value
|
||||
record_type
|
||||
dns_action: delete or add
|
||||
dns_records:
|
||||
- record_name
|
||||
record_value
|
||||
record_type
|
||||
dns_action: delete or add (default add)
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
@@ -29,9 +30,20 @@ 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:
|
||||
|
||||
- hosts: localhost
|
||||
roles:
|
||||
- { role: tco.dns, record_name: "foobar.opendoor.fr", record_value: "1.2.3.43, record_type: 'A', dns_action: 'add' }
|
||||
```yaml
|
||||
|
||||
- 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:
|
||||
- { role: tco.dns }
|
||||
```
|
||||
|
||||
License
|
||||
-------
|
||||
@@ -41,4 +53,4 @@ BSD
|
||||
Author Information
|
||||
------------------
|
||||
|
||||
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
|
||||
Thomas C <thomas@opendoor.fr>
|
||||
|
||||
@@ -1,32 +1,4 @@
|
||||
---
|
||||
# defaults file for tco.dns
|
||||
#
|
||||
dns_zone: opendoor.fr
|
||||
ovh_api_endpoint: ovh-eu
|
||||
ovh_api_application_key: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
31373037653235353036313530363531353265643131383861323936383532613462653961363462
|
||||
6639653636663332396466346335376261373166366530320a383863663337376233346161643665
|
||||
34303361633862633765393865636132653935616663306534333963613162363364666231383262
|
||||
3861616139623563620a636434363961626338306537623633633937666633393238373333393763
|
||||
62613133396439653331666631326433633665646364366433386662386363626435
|
||||
|
||||
|
||||
ovh_api_application_secret: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
30366433363031396663656632626337393731616435663732303265356265363333356465346233
|
||||
3035373061346430363062383164393133373562323733350a633633653632363236396432636432
|
||||
37336365383834653033626535383139366465613566363364613363376431393230346131363066
|
||||
3330323932333462370a643534626234653164396536376363666236643932376464626532396435
|
||||
30333231373430393362666266316465333739623334353635633761653833666666373962653537
|
||||
3965393137663932396163333062663865306433366538343138
|
||||
ovh_api_consumer_key: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
31386662353864346439616233303234356331396465643261346338393662306638616335613531
|
||||
6337656265636533356234393232346139663439303231640a383032353563623636396235386265
|
||||
32626237656331333362656236613062383338613834646535373163613864653965386362356263
|
||||
6361653338656665640a373336366533386665346136396535636164313863386539393432623831
|
||||
38336431316438343139316362343262313636663339313636353966613330623730326430663861
|
||||
3365656335326532633534643237386534646436623034346462
|
||||
|
||||
|
||||
dns_action: add
|
||||
|
||||
@@ -47,6 +47,7 @@ galaxy_info:
|
||||
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
|
||||
# Maximum 20 tags per role.
|
||||
|
||||
dependencies: []
|
||||
dependencies:
|
||||
#- { role: tco.changelog, myrole_name: ansible_dns }
|
||||
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
|
||||
# if you add dependencies to this list.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
---
|
||||
# tasks file for tco.dns
|
||||
|
||||
- name: manage dns record
|
||||
vars:
|
||||
state: "{{ (dns_action == 'delete' ) | ternary( 'absent', 'present' ) }}"
|
||||
@@ -9,8 +10,8 @@
|
||||
ovh_api_application_secret: "{{ ovh_api_application_secret }}"
|
||||
ovh_api_consumer_key: "{{ ovh_api_consumer_key }}"
|
||||
zone: "{{ dns_zone }}"
|
||||
record_name: "{{ record_name }}"
|
||||
record_value: "{{ record_value }}"
|
||||
record_type: "{{ record_type }}"
|
||||
record_name: "{{ item.record_name | ansible.builtin.regex_replace( '.'+dns_zone, '' ) }}"
|
||||
record_value: "{{ item.record_value }}"
|
||||
record_type: "{{ item.record_type }}"
|
||||
state: "{{ state }}"
|
||||
|
||||
loop: "{{ dns_records }}"
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
---
|
||||
- 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:
|
||||
- tco.dns
|
||||
- { role: tco.dns, dns_action: "delete", dns_records: "{{ records }}" }
|
||||
|
||||
Reference in New Issue
Block a user