Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nios_host_record always shows result is "changed" when alias is present #160

Open
fostermi opened this issue Oct 25, 2022 · 0 comments
Open

Comments

@fostermi
Copy link

When using the nios_host_record module with a host record that contains an alias parameter, the module, when run, always shows the resulting play/task as changed. If no alias is present, then the module will correctly show that the result hasn't changed.

Task in playbook with two records: one with aliases and another without.

---
- hosts: localhost
  vars:
    nios_provider:
      host: {{ infobloxhost }}
      username: {{ username }}
      password: {{ password }}
      wapi_version: '2.12'
    host_records:
      - name: infobloxhosttest.example.com
        ipv4addrs:
          - address: 172.16.23.4
        aliases:
          - infobloxctest3
      - name: infobloxhosttest2.example.com
        ipv4addrs:
           - address: 172.16.23.5
  connection: local
  tasks:

  - name: Configure an ipv4 host record
    infoblox.nios_modules.nios_host_record:
      name: "{{ item.name }}"
      ipv4: "{{ item.ipv4addrs }}"
      aliases: "{{ item.aliases | default(omit, true) }}"
      state: "{{ item.state | default('present', true) }}"
      view: "Internal"
      comment: "Managed by Ansible"
      provider:
        host: "{{ nios_provider.host }}"
        username: "{{ nios_provider.username }}"
        password: "{{ nios_provider.password }}"
    with_items:
      - "{{ host_records }}"
    when: item.state == "present"

ansible-playbook output:

PLAY [localhost] *****************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Configure an ipv4 host record] *********************************************************************************************************************************************************************************************************
changed: [localhost] => (item={'name': 'infobloxhosttest.example.com', 'ipv4addrs': [{'address': '172.16.23.4'}], 'aliases': ['infobloxctest3'], 'state': 'present'})
ok: [localhost] => (item={'name': 'infobloxhosttest2.example.com', 'ipv4addrs': [{'address': '172.16.23.5'}], 'state': 'present'})

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
localhost                  : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 

Environment

ansible [core 2.11.12] 
  config file = /Users/me/git/ansible/ansible.cfg
  configured module search path = ['/Users/me/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/me/venvs/ansible-2.12.13-nios/lib/python3.7/site-packages/ansible
  ansible collection location = /Users/me/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/me/venvs/ansible-2.12.13-nios/bin/ansible
  python version = 3.7.4 (default, Sep  7 2019, 18:31:37) [Clang 9.0.0 (clang-900.0.39.2)]
  jinja version = 3.1.2
  libyaml = True
  
infoblox-client    0.5.2

Infoblox.Nios_Modules v1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant