modernize, break out domains into vars files
This commit is contained in:
parent
5a16d04975
commit
7e17cf6b41
4 changed files with 25 additions and 33 deletions
13
play.yml
13
play.yml
|
@ -3,5 +3,14 @@
|
|||
hosts: localhost
|
||||
connection: local
|
||||
gather_facts: smart
|
||||
roles:
|
||||
- create-records
|
||||
vars:
|
||||
domains:
|
||||
- jlay.io
|
||||
- jlay.dev
|
||||
- init3.io
|
||||
tasks:
|
||||
- name: "enforce state for {{item}}"
|
||||
include_role:
|
||||
name: create-records
|
||||
vars_from: "{{item}}"
|
||||
with_items: "{{domains}}"
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
---
|
||||
zones:
|
||||
- name: jlay.dev
|
||||
state: present
|
||||
records:
|
||||
- name: git.ry1
|
||||
value: "107.181.235.67"
|
||||
type: A
|
||||
- name: ry1
|
||||
value: "107.181.235.66"
|
||||
type: A
|
||||
- name: ry2
|
||||
value: "107.181.235.74"
|
||||
type: A
|
|
@ -4,5 +4,17 @@
|
|||
include_vars:
|
||||
file: "~/.cloudflare.yml"
|
||||
|
||||
- include_tasks: zone.yml
|
||||
loop: "{{ zones }}"
|
||||
- name: "create records ({{domain}})"
|
||||
cloudflare_dns:
|
||||
zone: "{{ domain }}"
|
||||
record: "{{ record.name }}"
|
||||
value: "{{ record.value }}"
|
||||
type: "{{ record.type }}"
|
||||
solo: yes
|
||||
state: present
|
||||
account_email: "{{ cf_email }}"
|
||||
account_api_token: "{{ cf_token }}"
|
||||
loop: "{{ records }}"
|
||||
loop_control:
|
||||
loop_var: record
|
||||
when: (item.state is undefined) or (not item.state == 'absent')
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
---
|
||||
|
||||
- name: create records
|
||||
cloudflare_dns:
|
||||
zone: "{{ item.name }}"
|
||||
record: "{{ record.name }}"
|
||||
value: "{{ record.value }}"
|
||||
type: "{{ record.type }}"
|
||||
solo: yes
|
||||
account_email: "{{ cf_email }}"
|
||||
account_api_token: "{{ cf_token }}"
|
||||
loop: "{{ item.records }}"
|
||||
loop_control:
|
||||
loop_var: record
|
||||
when: (not item.state == 'absent')
|
Loading…
Reference in a new issue