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

aix_devices doesn't handle multiple attribute instances #53366

Closed
dpbianc opened this issue Mar 5, 2019 · 6 comments
Closed

aix_devices doesn't handle multiple attribute instances #53366

dpbianc opened this issue Mar 5, 2019 · 6 comments
Labels
affects_2.6 This issue/PR affects Ansible v2.6 aix AIX community bot_closed bug This issue/PR relates to a bug. collection:community.general collection Related to Ansible Collections work has_pr This issue has an associated PR. module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. system System category

Comments

@dpbianc
Copy link

dpbianc commented Mar 5, 2019

SUMMARY

The 1.1 version of the aix_devices module does not handle devices that may have multiple
instances of an attribute. For example, network interfaces can have multiple instances of
the alias4 attribute. I can add multiple alias4 attributes, but the module doesn't recognize
that there may be multiple alias4 values.

It appears that the module expects the attribute to have a single instance and the check routine only returns the first instance of an attribute.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Version 1.1 of module aix_devices (aix_devices.py)

ANSIBLE VERSION
ansible 2.6.2
  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 = /opt/freeware/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.15 (default, Jul 27 2018, 03:37:11) [GCC 6.3.0]

CONFIGURATION
CACHE_PLUGIN(env: ANSIBLE_CACHE_PLUGIN) = jsonfile
CACHE_PLUGIN_CONNECTION(env: ANSIBLE_CACHE_PLUGIN_CONNECTION) = /nas/depot/ansib
CACHE_PLUGIN_TIMEOUT(env: ANSIBLE_CACHE_PLUGIN_TIMEOUT) = 3600

OS / ENVIRONMENT

AIX 7.2

STEPS TO REPRODUCE
- name: Create en0 aliases
  hosts: vftmweb1d
  gather_facts: no
  tasks:
   - name: Create en0 aliases
    aix_devices:
      device: '{{ item.device }}'
      attributes:
        alias4: '{{ item.ipaddr }},{{ item.netmask }}'
      state: available
    with_items:
      - { device: 'en0', ipaddr: '10.10.10.2', netmask: '255.255.255.0' }
      - { device: 'en0', ipaddr: '10.10.10.3', netmask: '255.255.255.0' }
 
EXPECTED RESULTS

If the alias4 entries exist, the task should complete without changes.

ACTUAL RESULTS

If the alias4 entries exist, the first alias4 completes without change, the second is added again (which doesn't add a duplicate entry).


@dpbianc dpbianc added the bug This issue/PR relates to a bug. label Mar 5, 2019
@ansibot
Copy link
Contributor

ansibot commented Mar 5, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.6 This issue/PR affects Ansible v2.6 aix AIX community module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community. system System category labels Mar 5, 2019
@sivel sivel added the needs_triage Needs a first human triage before being processed. label Mar 6, 2019
@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Mar 6, 2019
@ansibot
Copy link
Contributor

ansibot commented Jul 13, 2019

@d-little
Copy link
Contributor

d-little commented Jul 14, 2019

On first run this appears to work as expected. On subsequent runs only the first attribute is listed as 'ok' and it continues to 'change' the remaining attrs.

I've spotted where this is going wrong in the code, fix to come ASAP.

[root@ANSIBLEHOST ansible]# cat test.yml
---
- name: Create en0 aliases
  hosts: TESTHOST
  become: true
  gather_facts: no

  tasks:
   - name: Create en0 aliases
     aix_devices:
       device: '{{ item.device }}'
       attributes:
         alias4: '{{ item.ipaddr }},{{ item.netmask }}'
       state: available
     with_items:
       - { device: 'en0', ipaddr: '10.216.30.220', netmask: '255.255.255.0' }
       - { device: 'en0', ipaddr: '10.216.30.221', netmask: '255.255.255.0' }



[root@ANSIBLEHOST ansible]# ansible-playbook -i /etc/ansible/test.ini -u deploy test.yml

PLAY [Create en0 aliases] ****************************************************************************************************************************************************************************************************************

TASK [Create en0 aliases] ****************************************************************************************************************************************************************************************************************
changed: [TESTHOST] => (item={'device': 'en0', 'ipaddr': '10.216.30.220', 'netmask': '255.255.255.0'})
changed: [TESTHOST] => (item={'device': 'en0', 'ipaddr': '10.216.30.221', 'netmask': '255.255.255.0'})

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



[root@ANSIBLEHOST ansible]# ansible-playbook -i /etc/ansible/test.ini -u deploy test.yml

PLAY [Create en0 aliases] ****************************************************************************************************************************************************************************************************************

TASK [Create en0 aliases] ****************************************************************************************************************************************************************************************************************
ok: [TESTHOST] => (item={'device': 'en0', 'ipaddr': '10.216.30.220', 'netmask': '255.255.255.0'})
changed: [TESTHOST] => (item={'device': 'en0', 'ipaddr': '10.216.30.221', 'netmask': '255.255.255.0'})

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



[root@ANSIBLEHOST ansible]# ansible-playbook -i /etc/ansible/test.ini -u deploy test.yml

PLAY [Create en0 aliases] ****************************************************************************************************************************************************************************************************************

TASK [Create en0 aliases] ****************************************************************************************************************************************************************************************************************
ok: [TESTHOST] => (item={'device': 'en0', 'ipaddr': '10.216.30.220', 'netmask': '255.255.255.0'})
changed: [TESTHOST] => (item={'device': 'en0', 'ipaddr': '10.216.30.221', 'netmask': '255.255.255.0'})

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

@d-little
Copy link
Contributor

d-little commented Jul 14, 2019

Submitted a fix in PR ##59081

@dpbianc Can you please test the version aix_devices.py in that PR and comment in the PR if it is/is not working for you? Thanks.

@ansibot ansibot added the has_pr This issue has an associated PR. label Jul 26, 2019
@ansibot ansibot added collection Related to Ansible Collections work collection:community.general needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md labels Apr 29, 2020
@ansibot
Copy link
Contributor

ansibot commented Aug 16, 2020

Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.

For further information, please see:
https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md

@ansibot ansibot closed this as completed Aug 16, 2020
@ansible ansible locked and limited conversation to collaborators Sep 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.6 This issue/PR affects Ansible v2.6 aix AIX community bot_closed bug This issue/PR relates to a bug. collection:community.general collection Related to Ansible Collections work has_pr This issue has an associated PR. module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. system System category
Projects
None yet
Development

No branches or pull requests

4 participants