You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.3 KiB
49 lines
1.3 KiB
# no longer needed
|
|
|
|
- block:
|
|
- name: slurp zone file
|
|
slurp:
|
|
src: "{{ nsd_data_dir }}/{{ ns_zone }}.zone"
|
|
register: zf
|
|
changed_when: false
|
|
|
|
|
|
- name: get SOA serial value
|
|
set_fact:
|
|
ns_old_serial: '{{ zf.content | b64decode | regex_search(''@\s+IN\s+SOA\s+\S+\s+\S+\s*\(\s*(\d+)'', ''\1'') | first | string }}'
|
|
|
|
|
|
- name: get current date
|
|
include_tasks: tasks/get_datetime.yml
|
|
vars:
|
|
format: YYMMDD
|
|
|
|
|
|
- name: replace outdated serial with current date
|
|
set_fact:
|
|
ns_new_serial: "{{ (current_date_time | string) ~ '01'}}"
|
|
when: ns_old_serial[:8] != (current_date_time | string)
|
|
|
|
|
|
- name: increase current serial
|
|
set_fact:
|
|
ns_new_serial: "{{ (ns_old_serial | int) + 1 }}"
|
|
when: (ns_old_serial[:8] == (current_date_time | string)) and ((ns_old_serial[8:10] | int) < 99)
|
|
|
|
delegate_to: nse1
|
|
|
|
|
|
- name: do not change current serial
|
|
set_fact:
|
|
ns_new_serial: "{{ ns_old_serial }}"
|
|
when: (ns_old_serial[:8] == (current_date_time | string)) and ((ns_old_serial[8:10] | int) >= 99)
|
|
delegate_to: nse1
|
|
|
|
|
|
- name: insert new serial
|
|
replace:
|
|
path: "{{ nsd_data_dir }}/{{ ns_zone }}.zone"
|
|
regexp: '(@\s+IN\s+SOA\s+\S+\s+\S+\s*\(\s*){{ ns_old_serial }}'
|
|
replace: '\g<1>{{ ns_new_serial }}'
|
|
notify: reload nsd zones
|
|
delegate_to: nse1
|
|
|