aboutsummaryrefslogtreecommitdiffstats
path: root/playbooks/dns_records.yml
blob: 93d635e49ab2835fdfc390b61cb7ab058db643b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
- name: add dns records for infrastructure hosts
  hosts: proxmox_hypervisors:opnsense_firewalls:unmanaged
  tags: dns
  roles:
    - dns_records

- name: add reverse dns records for firewall vlan interfaces
  hosts: freeipa_master
  tags: dns
  tasks:
    - name: create reverse dns zones
      ipadnszone:
        ipaadmin_principal: '{{ ipa_user }}'
        ipaadmin_password: '{{ ipa_pass }}'
        zone_name: '{{ item }}'
        state: present
      loop: "{{ vlans.values() | map(attribute='gateway') | ansible.utils.ipaddr('revdns') | map('regex_replace', '^[^.]+\\.', '') | unique }}"

    - name: create ptr records
      ipadnsrecord:
        ipaadmin_principal: '{{ ipa_user }}'
        ipaadmin_password: '{{ ipa_pass }}'
        zone_name: "{{ item | ansible.utils.ipaddr('revdns') | regex_replace('^[^.]+\\.', '') }}"
        record_name: '{{ item | split(".") | last }}'
        record_type: PTR
        record_value: '{{ groups["opnsense_firewalls"] | sort | first  }}.{{ domain }}.'
        state: present
      loop: "{{ vlans.values() | map(attribute='gateway') }}"