Commit 63d880a4 authored by Connor Cleveland's avatar Connor Cleveland

manage CF dns records with Ansible

parent d4529506
......@@ -24,6 +24,30 @@ ansible-syntax-check:
script:
- find ./playbooks/ -name '*.yml' | xargs -n1 ansible-playbook --syntax-check
update-cc-dns:
stage: run
script:
- ansible-playbook --user root ./playbooks/add_dns_records_cc.yml
only:
- master
when: manual
update-bfg-dns:
stage: run
script:
- ansible-playbook --user root ./playbooks/add_dns_records_bgf.yml
only:
- master
when: manual
update-knc-dns:
stage: run
script:
- ansible-playbook --user root ./playbooks/add_dns_records_knc.yml
only:
- master
when: manual
update-ubuntu:
stage: run
script:
......
......@@ -31,6 +31,7 @@ all:
mil-gsm-sp03.us.clevelandcoding.com:
mil-hapry-sp01.us.clevelandcoding.com:
mil-hapry-sp02.us.clevelandcoding.com:
chi-kncwb-sp01.us.clevelandcoding.com:
children:
docker_hosts:
hosts:
......
---
- hosts: localhost
become: false
vars:
email: "{{ ansible_env.CF_EMAIL }}"
token: "{{ ansible_env.CF_TOKEN }}"
bgf_zone: bellagoatfarms.com
ipv4: "{{ ansible_env.IPV4MKE }}"
ipv6: "{{ ansible_env.IPV6MKE }}"
tasks:
- name: Add A record for bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: true
proxied: true
ttl: 1
value: "{{ ipv4 }}"
record: "{{ bgf_zone }}"
type: A
state: present
- name: Add CNAME record for www.bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: true
proxied: true
ttl: 1
value: "{{ bgf_zone }}"
record: www
type: CNAME
state: present
- name: Add CNAME record for email.s.bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: true
proxied: false
ttl: 1
value: mailgun.org
record: email.s
type: CNAME
state: present
- name: Add CNAME record for imap.bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: true
proxied: false
ttl: 1
value: imap.yandex.ru
record: imap
type: CNAME
state: present
- name: Add CNAME record for mail.bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: true
proxied: false
ttl: 1
value: domain.mail.yandex.net
record: mail
type: CNAME
state: present
- name: Add CNAME record for smtp.bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: true
proxied: false
ttl: 1
value: smtp.yandex.ru
record: smtp
type: CNAME
state: present
- name: Add CNAME record for status.bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: true
proxied: false
ttl: 1
value: stats.uptimerobot.com
record: status
type: CNAME
state: present
- name: Add CNAME record for email.s.bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: true
proxied: false
ttl: 1
value: smtp.yandex.ru
record: smtp
type: CNAME
state: present
- name: add MXA for s.bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: false
proxied: false
ttl: 1
priority: 10
value: mxa.mailgun.org
record: s
type: MX
state: present
- name: add MXB for s.bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: false
proxied: false
ttl: 1
priority: 10
value: mxb.mailgun.org
record: s
type: MX
state: present
- name: add MX for bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: false
proxied: false
ttl: 1
priority: 10
value: mx.yandex.net
record: "{{ bgf_zone }}"
type: MX
state: present
- name: add domainkey bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: false
proxied: false
ttl: 1
value: "v=DKIM1; k=rsa; t=s; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQChg8/QkhsOWk96gq4gLeymXlIMSirirJeecyVzpGsG8HCdtW+INl3uUmkGx8B8Ol41+t0CboaOFzVSxv0MTJC0CPF8//x5YKGz3dI1MtVtNhXzTL16QAubus/No/+hvfRoUlH8gIsgzXYArysK9NsNPIyyQmFETKOSi96fzp71VwIDAQAB"
record: mail._domainkey
type: TXT
state: present
- name: add domainkey s.bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: false
proxied: false
ttl: 1
value: "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCs2G9vGIa4JTdxBpD9pheYMO4RpdEH+3DQWCQsf6WRu/pejLcI+EURsxks1Oduiv9kwTcraLY8z2HNh6IrJZ82F9aZgiduEOnCohoQ7A1tH86qIb0P4VFOaD58n+pZmNQ+tPmnmiAjJyf9EhHCZcWAHEyvVeNWztLetWKLjrvGrQIDAQAB"
record: mx._domainkey.s
type: TXT
state: present
- name: add TXT record s.bellagoatfarms.com
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ bgf_zone }}"
solo: false
proxied: false
ttl: 1
value: "v=spf1 include:mailgun.org ~all"
record: s
type: TXT
state: present
\ No newline at end of file
This diff is collapsed.
---
- hosts: localhost
become: false
vars:
email: "{{ ansible_env.CF_EMAIL }}"
token: "{{ ansible_env.CF_TOKEN }}"
friends_zone: friendsofknc.org
kish_zone: kishwauketoe.org
kncwb_zone: kncwb.org
ipv4: "{{ ansible_env.IPV4ORD }}"
ipv6: "{{ ansible_env.IPV6ORD }}"
tasks:
- name: Add A record for kishwauketoe.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ kish_zone }}"
solo: true
proxied: true
ttl: 1
value: "{{ ipv4 }}"
record: "{{ kish_zone }}"
type: A
state: present
- name: Add AAAA dns for kishwauketoe.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ kish_zone }}"
solo: true
proxied: true
ttl: 1
value: "{{ ipv6 }}"
record: "{{ kish_zone }}"
type: AAAA
state: present
- name: add CNAME for www.kishwauketoe.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ kish_zone }}"
solo: true
proxied: true
ttl: 1
value: "{{ kish_zone }}"
record: www
type: CNAME
state: present
- name: add CNAME for v3.kishwauketoe.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ kish_zone }}"
solo: true
proxied: true
ttl: 1
value: "{{ kish_zone }}"
record: v3
type: CNAME
state: present
- name: add CNAME for email.s.kishwauketoe.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ kish_zone }}"
solo: true
proxied: false
ttl: 1
value: mailgun.org
record: email.s
type: CNAME
state: present
- name: add MXA for s.kishwauketoe.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ kish_zone }}"
solo: false
proxied: false
ttl: 1
priority: 10
value: mxa.mailgun.org
record: s
type: MX
state: present
- name: add MXB for s.kishwauketoe.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ kish_zone }}"
solo: false
proxied: false
ttl: 1
priority: 10
value: mxb.mailgun.org
record: s
type: MX
state: present
- name: add domainkey s.kishwauketoe.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ kish_zone }}"
solo: true
proxied: true
ttl: 1
value: "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDN/jvZl8/Eo0tPFl/Srf29OfmBFQyOt+65OrAH63ezh8gsakO792it2/G86+c/8rkKkqz4lfQ1BfT7dZma0Zyz7RW+0ils99eZmzh6UZGA/LhH1sL3EletE0G1ESmZv5TeW04WkIJfiG1MPrHpaiN4bK57QrZkJCpzDz7IBDmjOQIDAQAB"
record: mailo._domainkey.s
type: TXT
state: present
- name: add spf for s.kishwauketoe.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ kish_zone }}"
solo: true
proxied: true
ttl: 1
value: "v=spf1 include:mailgun.org ~all"
record: s
type: TXT
state: present
- name: Add A record for friendsofknc.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ friends_zone }}"
solo: true
proxied: true
ttl: 1
value: "{{ ipv4 }}"
record: "{{ friends_zone }}"
type: A
state: present
- name: Add AAAA dns for friendsofknc.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ friends_zone }}"
solo: true
proxied: true
ttl: 1
value: "{{ ipv6 }}"
record: "{{ friends_zone }}"
type: AAAA
state: present
- name: add CNAME for www.friendsofknc.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ friends_zone }}"
solo: true
proxied: true
ttl: 1
value: "{{ friends_zone }}"
record: www
type: CNAME
state: present
- name: Add A record for kncwb.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ kncwb_zone }}"
solo: true
proxied: true
ttl: 1
value: "{{ ipv4 }}"
record: "{{ kncwb_zone }}"
type: A
state: present
- name: Add AAAA dns for kncwb.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ kncwb_zone }}"
solo: true
proxied: true
ttl: 1
value: "{{ ipv6 }}"
record: "{{ kncwb_zone }}"
type: AAAA
state: present
- name: add CNAME for www.kncwb.org
cloudflare_dns:
account_email: "{{ email }}"
account_api_token: "{{ token }}"
zone: "{{ kncwb_zone }}"
solo: true
proxied: true
ttl: 1
value: "{{ kncwb_zone }}"
record: www
type: CNAME
state: present
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment