Closed
Description
SUMMARY
If you create an (MX) Entry via nsupdate and than run the same thing again, the playbook will fail the second time.
ISSUE TYPE
- Bug Report
COMPONENT NAME
nsupdate
ANSIBLE VERSION
ansible 2.9.11
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Sep 26 2019, 13:23:47) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
DEFAULT_MANAGED_STR(/etc/ansible/ansible.cfg) =
Diese Datei wird von Ansible verwaltet.
Modifizierungen sind NICHT persitent.
Letzte Modifizierung: %Y-%m-%d %H:%M:%S
Tower-Server: towerserver.fqdn.de (Cluster PROD)
DEFAULT_ROLES_PATH(/etc/ansible/ansible.cfg) = [u'/etc/ansible/roles', u'/usr/share/ansible/roles', u'/opt/ble/ans
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT
RHEL 7
Bind: 9.11.4-P2-RedHat-9.11.4-16.P2.el7_8.6
STEPS TO REPRODUCE
- Setup a bind (we use CHROOT)
- Create the Zone and a tsig-Key
- Run the Playbook below
- Run it again (this will fail)
- hosts: dns.example.com
name: Set DNS Records
vars:
ddns_key_algorithm: hmac-sha512
ddns_key_name: ansible
ddns_key_secret: "****NSUPDATEKEY****"
external_dns_record_records:
- name: '@'
type: MX
value:
- 10 mail.example.com.
external_dns_record_zone: zone-example.com
external_dns_record_zonedir: /etc/named/zones
tasks:
- name: TTL laden
shell: "/bin/grep TTL {{ external_dns_record_zonedir }}/{{ external_dns_record_zone }} | /bin/head -n 1 | /bin/awk '{print $2}'"
register: external_dns_record_ttl
changed_when: false
args:
warn: false
- name: Eintrag hinzufügen
nsupdate:
key_algorithm: '{{ ddns_key_algorithm }}'
key_name: '{{ ddns_key_name }}'
key_secret: '{{ ddns_key_secret }}'
server: "127.0.0.1"
record: '{{ item.name }}'
type: '{{ item.type }}'
ttl: '{{ external_dns_record_ttl.stdout }}'
value: '{{ item.value }}'
zone: '{{ external_dns_record_zone }}'
state: present
notify:
- sync named-dynamic-zones
loop: '{{ external_dns_record_records }}'
loop_control:
label: '{{ item.name }} ({{ item.type }})'
handlers:
- name: sync named-dynamic-zones # noqa 305
shell: /sbin/rndc sync
become: yes
EXPECTED RESULTS
Playbook/Tasks results as "ok"
ACTUAL RESULTS
{
"exception": "Traceback (most recent call last):
File \"/home/seransible/.ansible/tmp/ansible-tmp-1598520715.18-51-235193078687524/AnsiballZ_nsupdate.py\", line 102, in <module>
_ansiballz_main()
File \"/home/seransible/.ansible/tmp/ansible-tmp-1598520715.18-51-235193078687524/AnsiballZ_nsupdate.py\", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File \"/home/seransible/.ansible/tmp/ansible-tmp-1598520715.18-51-235193078687524/AnsiballZ_nsupdate.py\", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.net_tools.nsupdate', init_globals=None, run_name='__main__', alter_sys=True)
File \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module
fname, loader, pkg_name)
File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code
exec code in run_globals
File \"/tmp/ansible_nsupdate_payload_5ONYcW/ansible_nsupdate_payload.zip/ansible/modules/net_tools/nsupdate.py\", line 448, in <module>
File \"/tmp/ansible_nsupdate_payload_5ONYcW/ansible_nsupdate_payload.zip/ansible/modules/net_tools/nsupdate.py\", line 431, in main
File \"/tmp/ansible_nsupdate_payload_5ONYcW/ansible_nsupdate_payload.zip/ansible/modules/net_tools/nsupdate.py\", line 270, in create_or_update_record
File \"/tmp/ansible_nsupdate_payload_5ONYcW/ansible_nsupdate_payload.zip/ansible/modules/net_tools/nsupdate.py\", line 374, in record_exists
File \"/tmp/ansible_nsupdate_payload_5ONYcW/ansible_nsupdate_payload.zip/ansible/modules/net_tools/nsupdate.py\", line 394, in ttl_changed
IndexError: list index out of range
",
"ansible_loop_var": "item",
"_ansible_item_label": "@ (MX)",
"module_stderr": "Shared connection to dns.example.com closed.
",
"rc": 1,
"module_stdout": "Traceback (most recent call last):
File \"/home/seransible/.ansible/tmp/ansible-tmp-1598520715.18-51-235193078687524/AnsiballZ_nsupdate.py\", line 102, in <module>
_ansiballz_main()
File \"/home/seransible/.ansible/tmp/ansible-tmp-1598520715.18-51-235193078687524/AnsiballZ_nsupdate.py\", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File \"/home/seransible/.ansible/tmp/ansible-tmp-1598520715.18-51-235193078687524/AnsiballZ_nsupdate.py\", line 40, in invoke_module
runpy.run_module(mod_name='ansible.modules.net_tools.nsupdate', init_globals=None, run_name='__main__', alter_sys=True)
File \"/usr/lib64/python2.7/runpy.py\", line 176, in run_module
fname, loader, pkg_name)
File \"/usr/lib64/python2.7/runpy.py\", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File \"/usr/lib64/python2.7/runpy.py\", line 72, in _run_code
exec code in run_globals
File \"/tmp/ansible_nsupdate_payload_5ONYcW/ansible_nsupdate_payload.zip/ansible/modules/net_tools/nsupdate.py\", line 448, in <module>
File \"/tmp/ansible_nsupdate_payload_5ONYcW/ansible_nsupdate_payload.zip/ansible/modules/net_tools/nsupdate.py\", line 431, in main
File \"/tmp/ansible_nsupdate_payload_5ONYcW/ansible_nsupdate_payload.zip/ansible/modules/net_tools/nsupdate.py\", line 270, in create_or_update_record
File \"/tmp/ansible_nsupdate_payload_5ONYcW/ansible_nsupdate_payload.zip/ansible/modules/net_tools/nsupdate.py\", line 374, in record_exists
File \"/tmp/ansible_nsupdate_payload_5ONYcW/ansible_nsupdate_payload.zip/ansible/modules/net_tools/nsupdate.py\", line 394, in ttl_changed
IndexError: list index out of range
",
"item": {
"type": "MX",
"name": "@",
"value": [
"10 mail.example.com."
]
},
"changed": false,
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"_ansible_no_log": false
Activity