Add intdomain variable to simplify configs
This commit is contained in:
parent
05b4c3a9f4
commit
e55dd35605
4 changed files with 9 additions and 8 deletions
|
@ -3,6 +3,7 @@
|
||||||
mem_size: 512
|
mem_size: 512
|
||||||
|
|
||||||
intnet: "{{ network_interfaces[0].ipaddr + '/' + network_interfaces[0].netmask }}"
|
intnet: "{{ network_interfaces[0].ipaddr + '/' + network_interfaces[0].netmask }}"
|
||||||
|
intdomain: "{{ inventory_hostname.split('.')[1:] | join('.') }}"
|
||||||
|
|
||||||
network_vip_interfaces:
|
network_vip_interfaces:
|
||||||
- device: vio0
|
- device: vio0
|
||||||
|
@ -43,7 +44,7 @@ unbound_zones:
|
||||||
{% else -%}
|
{% else -%}
|
||||||
{{ reverse[:-1] | split('.', 1) | last -}}
|
{{ reverse[:-1] | split('.', 1) | last -}}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
- "{{ inventory_hostname.split('.')[1:] | join('.') }}"
|
- "{{ intdomain }}"
|
||||||
|
|
||||||
# use custom firewall config
|
# use custom firewall config
|
||||||
firewall_src: pf.conf.gw_dna.j2
|
firewall_src: pf.conf.gw_dna.j2
|
||||||
|
|
|
@ -42,26 +42,26 @@
|
||||||
|
|
||||||
- name: Copy DNS private key
|
- name: Copy DNS private key
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: "{{ tls_private }}/dns.{{ inventory_hostname.split('.')[1] }}.foo.sh.key"
|
dest: "{{ tls_private }}/dns.{{ intdomain }}.key"
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
mode: "0600"
|
mode: "0600"
|
||||||
owner: root
|
owner: root
|
||||||
group: "{{ ansible_wheel }}"
|
group: "{{ ansible_wheel }}"
|
||||||
with_first_found:
|
with_first_found:
|
||||||
- "/srv/letsencrypt/live/dns.{{ inventory_hostname.split('.')[1] }}.foo.sh/privkey.pem"
|
- "/srv/letsencrypt/live/dns.{{ intdomain }}/privkey.pem"
|
||||||
- "/srv/ca/private/{{ inventory_hostname }}.key"
|
- "/srv/ca/private/{{ inventory_hostname }}.key"
|
||||||
tags: certificates
|
tags: certificates
|
||||||
notify: Restart unbound
|
notify: Restart unbound
|
||||||
|
|
||||||
- name: Copy DNS certificate and ca cert
|
- name: Copy DNS certificate and ca cert
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
dest: "{{ tls_certs }}/dns.{{ inventory_hostname.split('.')[1] }}.foo.sh.crt"
|
dest: "{{ tls_certs }}/dns.{{ intdomain }}.crt"
|
||||||
src: "{{ item }}"
|
src: "{{ item }}"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
owner: root
|
owner: root
|
||||||
group: "{{ ansible_wheel }}"
|
group: "{{ ansible_wheel }}"
|
||||||
with_first_found:
|
with_first_found:
|
||||||
- "/srv/letsencrypt/live/dns.{{ inventory_hostname.split('.')[1] }}.foo.sh/fullchain.pem"
|
- "/srv/letsencrypt/live/dns.{{ intdomain }}/fullchain.pem"
|
||||||
- "/srv/ca/certs/hosts/{{ inventory_hostname }}.crt"
|
- "/srv/ca/certs/hosts/{{ inventory_hostname }}.crt"
|
||||||
tags: certificates
|
tags: certificates
|
||||||
notify: Restart unbound
|
notify: Restart unbound
|
||||||
|
|
|
@ -42,7 +42,7 @@ subnet {{ intnet | ansible.utils.ipaddr('network') }} netmask {{ intnet | ansibl
|
||||||
option broadcast-address {{ intnet | ansible.utils.ipaddr('broadcast') }};
|
option broadcast-address {{ intnet | ansible.utils.ipaddr('broadcast') }};
|
||||||
option routers {{ intnet | ansible.utils.ipaddr(1) | ansible.utils.ipaddr('address')}};
|
option routers {{ intnet | ansible.utils.ipaddr(1) | ansible.utils.ipaddr('address')}};
|
||||||
|
|
||||||
option domain-name "{{ inventory_hostname.split('.')[1] }}.foo.sh";
|
option domain-name "{{ intdomain }}";
|
||||||
option domain-name-servers {{ intnet | ansible.utils.ipaddr(10) | ansible.utils.ipaddr('address') }}, {{ intnet | ansible.utils.ipaddr(11) | ansible.utils.ipaddr('address') }}, {{ intnet | ansible.utils.ipaddr(12) | ansible.utils.ipaddr('address') }};
|
option domain-name-servers {{ intnet | ansible.utils.ipaddr(10) | ansible.utils.ipaddr('address') }}, {{ intnet | ansible.utils.ipaddr(11) | ansible.utils.ipaddr('address') }}, {{ intnet | ansible.utils.ipaddr(12) | ansible.utils.ipaddr('address') }};
|
||||||
use-host-decl-names on;
|
use-host-decl-names on;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@ server:
|
||||||
interface: {{ intnet | ansible.utils.ipaddr(12) | ansible.utils.ipaddr('address') }}@53
|
interface: {{ intnet | ansible.utils.ipaddr(12) | ansible.utils.ipaddr('address') }}@53
|
||||||
interface: {{ intnet | ansible.utils.ipaddr(12) | ansible.utils.ipaddr('address') }}@853
|
interface: {{ intnet | ansible.utils.ipaddr(12) | ansible.utils.ipaddr('address') }}@853
|
||||||
|
|
||||||
tls-service-key: {{ tls_private }}/dns.{{ inventory_hostname.split('.')[1] }}.foo.sh.key
|
tls-service-key: {{ tls_private }}/dns.{{ intdomain }}.key
|
||||||
tls-service-pem: {{ tls_certs }}/dns.{{ inventory_hostname.split('.')[1] }}.foo.sh.crt
|
tls-service-pem: {{ tls_certs }}/dns.{{ intdomain }}.crt
|
||||||
tls-cert-bundle: {{ tls_bundle }}
|
tls-cert-bundle: {{ tls_bundle }}
|
||||||
|
|
||||||
access-control: 127.0.0.0/8 allow
|
access-control: 127.0.0.0/8 allow
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue