Code Monkey home page Code Monkey logo

ansible-power-aix's Introduction

IBM Power Systems AIX Collection

Scope

The IBM Power Systems AIX collection provides modules that can be used to manage configurations and deployments of Power AIX systems. The collection content helps to include workloads on Power platforms as part of an enterprise automation strategy through the Ansible ecosystem.

The IBM Power Systems AIX collection is included as an upstream collection under the Ansible Content for IBM Power Systems umbrella of community content.

Join the Power Research Program

Become an IBM Power Design Partner. Engage with our Power Research team across various research studies to shape the future of Anisble on Power: https://ibm.biz/BdyRyk

Usage

This repository contains some example best practices for open source repositories:

Requirements

  • AIX 7.3 will require additional software only for the flrtvc, nim_flrtvc and nim_vios_hc AIX Ansible Collection's modules. Additional open-source software is installed by configuring [DNF] first. YUM only supports Python2.
    • Modules flrtvc and nim_flrtvc requires wget. See demo playbooks examples.
    • Module nim_vios_hc software requirements will be automatically installed using power_aix_vioshc role. See demo playbook examples.

Platforms

  • AIX 7.1
  • AIX 7.2
  • AIX 7.3

Ansible

  • Requires Ansible 2.9 or newer
  • For help installing Ansible, refer to the Installing Ansible section of the Ansible Documentation
  • For help installing the ibm.power_aix collection, refer to the install page of this project

Python

  • Requires Python 3.8 or newer
  • To install (or upgrade) Python on AIX 7.1 and 7.2, you must first configure YUM. As part of YUM installation, Python2 will be installed by default.
  • After setting up and installing YUM, you may update all the packages to the latest level using the yum update command.
  • AIX 7.3 will come with Python3 pre-installed. Ansible will work with AIX 7.3 with no need for additional software.

Resources

Documentation of modules is generated on GitHub Pages.

Question, Issue or Contribute

If you have any questions or issues you can create a new issue here.

Pull requests are very welcome! Make sure your patches are well tested. Ideally create a topic branch for every separate change you make. For example:

  1. Fork the repo
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License & Authors

If you would like to see the detailed LICENSE click here.

Copyright:: 2021- IBM, Inc

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Authors:

ansible-power-aix's People

Contributors

d-little avatar dpkshetty avatar gopinath-g avatar henkwiedig avatar jaywcarman avatar jdejoya17 avatar jlrebello avatar kavanabhat avatar lionelwidmer avatar madhu-pillai avatar mgomathi avatar neetjoy avatar neikei avatar nitismis avatar pbfinley1911 avatar ptsiamis avatar pvtorres avatar r-w-taylor avatar raeyacld avatar rich-j-aix avatar robinvy avatar s-man-g avatar schamola avatar stephannavarro avatar stephenulmer avatar stevemar avatar stevemunday62 avatar sumitradawn avatar syahrul-aiman avatar thedoubl3j avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-power-aix's Issues

unmount only one remote NFS dir fails.

Trying to use the amount option to unmount one remote NFS mounted directory.
It only allows me to unmount all remote directories via the mount_all: remote option.

How can I just unmount on remote directory?

Thanks

This is my playbook:

name: Unmount remote filesystems
ibm.power_aix.mount:
state: umount
mount_dir: /mnt

Python Error when using suma.py module

Using Ansible 2.9 and Python 3.6.8
Problem:
when trying to use suma module to download service pack to aix endpoint getting the following python output ending in a python error:
ValueError: too many values to unpack

[root@POWERVCLAB1 aix]# ansible-playbook aix_suma.yml

PLAY [NIM check for system updates] ************************************************************************************

TASK [check initial oslevel] *******************************************************************************************
ok: [ansible-vm1]

TASK [debug] ***********************************************************************************************************
ok: [ansible-vm1] =>
initial_oslevel:
ansible_facts:
discovered_interpreter_python: /usr/bin/python
changed: false
cmd: oslevel -s
delta: '0:00:01.818279'
end: '2020-09-24 08:45:56.483716'
failed: false
rc: 0
start: '2020-09-24 08:45:54.665437'
stderr: ''
stderr_lines: []
stdout: 7100-05-03-1846
stdout_lines:
- 7100-05-03-1846

TASK [create temp filesystem for suma updates] *************************************************************************
changed: [ansible-vm1]

TASK [debug] ***********************************************************************************************************
ok: [ansible-vm1] =>
results:
changed: true
failed: false
msg: Modification of Filesystem '/export/backups/suma_download' completed

TASK [mount new filesystem] ********************************************************************************************
ok: [ansible-vm1]

TASK [debug] ***********************************************************************************************************
ok: [ansible-vm1] =>
suma_output:
changed: false
failed: false
msg: Filesystem/Mount point '/export/backups/suma_download' already mounted

TASK [check oslevel] ***************************************************************************************************
ok: [ansible-vm1]

TASK [debug] ***********************************************************************************************************
ok: [ansible-vm1] =>
new_oslevel:
changed: false
cmd: oslevel -s
delta: '0:00:01.817289'
end: '2020-09-24 08:46:02.432532'
failed: false
rc: 0
start: '2020-09-24 08:46:00.615243'
stderr: ''
stderr_lines: []
stdout: 7100-05-03-1846
stdout_lines:
- 7100-05-03-1846

PLAY RECAP *************************************************************************************************************
ansible-vm1 : ok=8 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

[root@POWERVCLAB1 aix]# vim aix_suma.yml
[root@POWERVCLAB1 aix]# ansible-playbook aix_suma.yml

PLAY [NIM check for system updates] ************************************************************************************

TASK [check initial oslevel] *******************************************************************************************
ok: [ansible-vm1]

TASK [create temp filesystem for suma updates] *************************************************************************
changed: [ansible-vm1]

TASK [mount new filesystem] ********************************************************************************************
ok: [ansible-vm1]

TASK [AIX SUMA preview] ************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: too many values to unpack
fatal: [ansible-vm1]: FAILED! => changed=false
module_stderr: |-
Shared connection to ansible-vm1 closed.
module_stdout: |-
Traceback (most recent call last):
File "/.ansible/tmp/ansible-tmp-1600962524.8442993-25375-155387106713494/AnsiballZ_suma.py", line 102, in
_ansiballz_main()
File "/.ansible/tmp/ansible-tmp-1600962524.8442993-25375-155387106713494/AnsiballZ_suma.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/.ansible/tmp/ansible-tmp-1600962524.8442993-25375-155387106713494/AnsiballZ_suma.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible_collections.ibm.power_aix.plugins.modules.suma', init_globals=None, run_name='main', alter_sys=True)
File "/opt/freeware/lib/python2.7/runpy.py", line 176, in run_module
fname, loader, pkg_name)
File "/opt/freeware/lib/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/opt/freeware/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/tmp/ansible_suma_payload__YD5_T/ansible_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/suma.py", line 869, in
File "/tmp/ansible_suma_payload__YD5_T/ansible_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/suma.py", line 859, in main
File "/tmp/ansible_suma_payload__YD5_T/ansible_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/suma.py", line 669, in suma_download
ValueError: too many values to unpack
msg: |-
MODULE FAILURE
See stdout/stderr for the exact error
rc: 1

PLAY RECAP *************************************************************************************************************
ansible-vm1 : ok=3 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

Here is the playbook content:

[root@POWERVCLAB1 aix]# cat aix_suma.yml

  • name: "NIM check for system updates"
    hosts: ansible-vm1
    gather_facts: no

    collections:

    • ibm.power_aix

    vars:
    suma_action: preview
    suma_targets: ansible-vm1
    suma_oslevel: latest
    suma_download_dir: /export/backups/suma_download

vm_targets: ansible_vm1

tasks:

- name: check initial oslevel
  shell: "oslevel -s"
  register: initial_oslevel
  changed_when: false

- debug: var=initial_oslevel

- name: create temp filesystem for suma updates
  filesystem:
    filesystem: "{{ suma_download_dir }}"
    attributes: size=30G
    state: present
    vg: ntestvg
    auto_mount: true
  register: results

- debug: var=results

- name: mount new filesystem
  mount:
    mount_dir: "{{ suma_download_dir }}"
    state: mount

- name: "AIX SUMA {{ suma_action }}"
  suma:
    action: "{{ suma_action }}"
    description: "{{ suma_action }} available updates"
    oslevel: "{{ suma_oslevel }}"
    download_dir: "{{ suma_download_dir }}"
  register: suma_output
- debug: var=suma_output

- name: check oslevel
  shell: "oslevel -s"
  register: new_oslevel
  changed_when: false

- debug: var=new_oslevel

user module to remove home directory too

When using the ibm.power_aix.user module to remove a user, there is no option to also remove the users home directory. The ansible core user module does allow this via the remove/force options.

Would it be possible to allow your user module with state=absent to remove the home directory too.

edit tags in galaxy.yml

The tags currently found in the galaxy.yml file would be good for a blog post but AH utilizes these tags to help users find specific, preset tags based on use case. This list can be found when first landing in AH.

Screenshot from 2020-06-02 17-40-27

I would add just infrastructure to this list.

ibm.power_aix.filesystem reports changes when none occur

Describe the bug
ibm.power_aix.filesystem reports changed when doing nothing.

To Reproduce

Run this play twice in succession:

---
- hosts: rdu1
  gather_facts: no
  vars:
    example_size: 5G
  tasks:
    - name: Create File System
      ibm.power_aix.filesystem:
        state: present
        filesystem: /export/example
        vg: rootvg
        attributes: "size={{ example_size }}"
        auto_mount: yes

Expected behavior
The task should not report that anything has changed on subsequent runs (when nothing has changed).

Screenshots
First run:

PLAY [rdu1] **********************************************************************************************************

TASK [Create File System] ********************************************************************************************
changed: [rdu1]

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

All subsequent runs:

PLAY [rdu1] **********************************************************************************************************

TASK [Create File System] ********************************************************************************************
changed: [rdu1]

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

Environment (please complete the following information):

  • OS: AIX 7200-05-01-2038
  • Python Version: 2.7.10 (installed at the same time as YUM)

Additional context
These things do not change the problem:

  • mounting the file system in between runs
  • gather_facts: yes

Allow nim module to work for new installs

Is your feature request related to a problem? Please describe.
Currently, works only for fileset updates with lppsource, not new installs. i.e. the fileset should already exist on the nim client for it to work

Describe the solution you'd like
Allow the ability to install new filesets

Describe alternatives you've considered
the suma and nim_suma modules don't seem to address this use case. Currently, the seeming best alternative is script module for the ntp4 installs and doing the error checking in the script

Additional context
Add any other context or screenshots about the feature request here.

Failure on PowerHA nodes with lvm_facts

Hello,

on some cluster nodes i get a failure during gathering lvm_facts. It has todo with volume groups that are clustered. If i do the gather only on rootvg's i get no error on these nodes.

The output if the failure happens:

fatal: [l01tic46m]: FAILED! => {
    "changed": false,
    "module_stderr": "Shared connection to x.x.x.x closed.\r\n",
    "module_stdout": "my_b_vg\r\ncaavg_private\r\nTraceback (most recent call last):\r\n  File \"/root/.ansible/tmp/ansible-tmp-1612100775.564891-71716-273388914997417/AnsiballZ_lvm_facts.py\", line 102, in <module>\r\n    _ansiballz_main()\r\n  File \"/root/.ansible/tmp/ansible-tmp-1612100775.564891-71716-273388914997417/AnsiballZ_lvm_facts.py\", line 94, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/root/.ansible/tmp/ansible-tmp-1612100775.564891-71716-273388914997417/AnsiballZ_lvm_facts.py\", line 40, in invoke_module\r\n    runpy.run_module(mod_name='ansible_collections.ibm.power_aix.plugins.modules.lvm_facts', init_globals=None, run_name='__main__', alter_sys=True)\r\n  File \"/opt/lib/python3.8/runpy.py\", line 207, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File \"/opt/lib/python3.8/runpy.py\", line 97, in _run_module_code\r\n    _run_code(code, mod_globals, init_globals,\r\n  File \"/opt/lib/python3.8/runpy.py\", line 87, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_ibm.power_aix.lvm_facts_payload__9c1hfv1/ansible_ibm.power_aix.lvm_facts_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/lvm_facts.py\", line 434, in <module>\r\n  File \"/tmp/ansible_ibm.power_aix.lvm_facts_payload__9c1hfv1/ansible_ibm.power_aix.lvm_facts_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/lvm_facts.py\", line 428, in main\r\n  File \"/tmp/ansible_ibm.power_aix.lvm_facts_payload__9c1hfv1/ansible_ibm.power_aix.lvm_facts_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/lvm_facts.py\", line 390, in load_lvs\r\nIndexError: list index out of range\r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

AIX Level is: 7200-02-06-2016
PowerHA Level is: 7.2.4 SP1
Python Version 3.8.5
Ansible Version: 2.10.5
ibm.power_aix version 1.2.1

ibm.power_aix.nim should be able to define NIM resources

Is your feature request related to a problem? Please describe.
When setting up or maintaining a NIM server with the power_aix collection, there is no way to define resources from existing files or from other resources.

Describe the solution you'd like
I would like to be able to use power_aix.nim to define at least this subset of the NIM object types:

  • lpp_source
  • spot
  • bosinst_data
  • exclude_files
  • mksysb
  • script
  • fb_script
  • res_group (I never used to use these, but it's currently required to actually perform an install with power_aix.nim)

I am working around this as described below, but need to begin removing my work-around code as we get closer to production deployments.

Describe alternatives you've considered
I'm currently using the command module to run nim -o define, and burning YAML to make it as idempotent as possible. This method requires the end-user to perform duties in the play that are better implemented inside the module.

Additional context
I am happy to implement this, but want an issue tracking it to avoid duplicate effort.

A generic define operation will eventually cause a breaking change, as define_script should be subsumed by it. The initial implementation can stub define_script to the new, internal, generic define logic. I will need to be directed on how that deprecation should work.

My initial idea is to add the rest of the object type keys as parallels to lpp_source, script, etc., and use them appropriately for define (and eventually bos_inst and other operations). I think there is always a polarity so that this would be well-defined. For example, one can define a spot from an lpp_source, but not the other way around.

Moun

Describe the bug
Mount is giving an error when I am trying to unmount a filesystem

To Reproduce

Expected behavior
Disk should be unmounted

Screenshots

Playbook

 tasks:
    - name: Umount filesystems
       become: true
       ibm.power_aix.mount:
        mount_dir: /dev/fspure_dr_data0
        state: umount

  ansible_facts:
    discovered_interpreter_python: /usr/bin/python
  cmd: df
  msg: Failed to get the filesystem name. Command 'df' failed.
  rc: 1
  stderr: ''
  stderr_lines: <omitted>
  stdout: |-
    Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
    /dev/hd4         1572864    948664   40%    20679    16% /
    /dev/hd2        50331648  27526752   46%    67013     3% /usr
    /dev/hd9var      5242880   3450168   35%     4487     2% /var
    /dev/hd3          524288    237552   55%     1077     4% /tmp
    /dev/hd1        41943040  25919024   39%     1911     1% /home

Environment (please complete the following information):

  • OS: AIX 7200-04-02-2028
  • Python Version: Python 2.7.10
  • OpenSSH Version: [e.g. 1.0.2]
  • Ansible Version: ansible 2.9.20
  • AIX Collection Version: Newest on Galaxy 2021-05-04

Additional context

I have tired with the filesystem both mounted and unmounted, both gave the same error. ibm.power_aix.mount gives the same results.

reboot โ€“ Reboot AIX machines

In the example, connect_timeout is invalid

- name: "Reboot a machine"
  reboot:
    pre_reboot_delay: 20
    post_reboot_delay: 20
    connect_timeout: 10
    reboot_timeout: 300

flrtvc module questions

Hi
We ran the flrtvc module successfully but need help to understand the reports we are getting.
We are also not sure how to get the apar.csv file? do we download it and put on the controller?

Here is what we got:

dkda3229:root[/usr/sys/inst.images/work]# ls -ltr
total 765656
-rw-r----- 1 root system 1372160 Sep 05 2014 nas1_fix.tar
-rwx------ 1 root system 11719 Aug 27 2015 LICENSE.txt
-rw-r--r-- 1 root system 36296 Jan 18 2019 flrtvc.ksh
drwxrwxr-x 2 root system 256 Jan 18 2019 __MACOSX
-rw-r----- 1 root system 178432000 Mar 30 13:02 gencore_fix.tar
-rw-r----- 1 root system 23326720 Mar 30 13:02 bind_fix18.tar
-rw-r----- 1 root system 45434880 Apr 14 15:02 openssl_fix33.tar
-rw-r----- 1 root system 142694400 Jun 15 21:04 trace_fix.tar
-rw-r--r-- 1 root system 548946 Jun 23 09:50 hiper_security.csv
drwxr-x--- 7 root system 256 Jun 23 09:59 tardir
-rw-r----- 1 root system 15467 Jun 23 10:07 FLRTVC-latest.zip
-rw-r----- 1 root system 115031 Jun 23 10:07 lslpp.txt
-rw-r----- 1 root system 9837 Jun 23 10:07 emgr.tx
from Frank (External) to Everyone: 10:10 AM

our playbook was:


  • name: Flrtvc
    hosts: dkda3229
    gather_facts: false
    tasks:
    • name: Download patches for security vulnerabilities
      ibm.power_aix.flrtvc:
      apar: all
      path: /usr/sys/inst.images
      download_only: yes

csv: /mnt/unix/aix/ansible/playbooks/apar.csv

alt_disk -> "No free disk available"

Fails with no disk available error, tried targets: hdisk1, disk_size_policy: nearest, and disk_size_policy: minimize.

alt disk copy works fine from AIX cli

TASK [Perform an alternate disk copy of the rootvg to hdisk1] fatal: [hostname]: FAILED! => {"changed": false, 
"msg": "No free disk available", "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}

- name: Perform an alternate disk copy of the rootvg to hdisk1
ibm.power_aix.alt_disk:
  targets: hdisk1

This is the remote node info, same node used to test other modules successfully

root@:/root# lsdev -Cc disk
hdisk0 Available 10-T1-01 MPIO FCP Default Disk
hdisk1 Available 10-T1-01 MPIO FCP Default Disk

root@:/root# lspv
hdisk0          00fa4b4ada7835e9                    rootvg          active
hdisk1          none                                None

root@:/root# bootinfo -s hdisk1
102400
root@:/root# bootinfo -s hdisk0
102400

ibm.power_aix.devices requires knowledge of current device state to know outcome of task

Describe the bug
ibm.power_aix.devices is capable of updating the attributes of a device, but it is necessary to know the current state of the device to know what the result of the task will be.

To Reproduce
The following task will silently not set the IP address on the interface if it is in the "defined" state, but will instead make the interface available. A following run would then yield different behavior and a different finished state.

    - ibm.power_aix.devices:
        device: "en4"
        state: available
        attributes:
          netaddr: "10.100.10.50"
          netmask: "255.255.255.0"

Expected behavior
The module should make the user's assertion about the state and attributes of a device true.

Environment:

  • OS: AIX 7.2TL5
  • Python Version: 2.7
  • AIX Collection Version: HEAD -> dev-collection

unable to perform vios health check

Describe the bug
trying to execute vios health check playbook.

  • name: "VIOs health check playbook"
    hosts: nimna2
    gather_facts: no

    collections:

    • ibm.power_aix

    tasks:

    • name: Perform a health check
      nim_vios_hc:
      targets: "sharedna12vio1"
      action: health_check
      register: result
    • debug: var=result
      #######Getting the following output, even though my VIOs is listed as nim object #########################
      output:
    • VIOS Health Check operation for ['sharedna12vio1']
    • ' Warning: Empty target list'
      status: {}
      stderr: ''
      stderr_lines: []
      stdout: ''
      stdout_lines: []
      targets: []

Environment (please complete the following information):

  • OS: [RHEL 7.7, Ansible 2.9]
  • Python Version [ 2.7.5]

Bad default value for parts attribute in installp.py

Describe the bug
There's an issue with module installp.py (Reported by dpkshetty)

Around line 282: this will cause an error because of the default used with parts (None).

parts = module.params['parts']
strparts = ''
for part in parts:
if part == 'root':
strparts += 'r'
elif part == 'share':
strparts += 's'
elif part == 'usr':
strparts += 'u'

To Reproduce
Steps to reproduce the behavior:

  • name: Install package from repository
    ibm.power_aix.installp:
    action: apply
    bosboot: False
    device: /export/nim/lpp_source/723lpp_res
    install_list: tk
    agree_licenses: True

Expected behavior
The fileset should attempt to install without traceback errors

Screenshots
This will produce the following error if a value isn't passed in for the parts attribute:
Traceback (most recent call last):
File "/.ansible/tmp/ansible-tmp-1598275717.76-6642173712374/AnsiballZ_installp.py", line 102, in
_ansiballz_main()
File "/.ansible/tmp/ansible-tmp-1598275717.76-6642173712374/AnsiballZ_installp.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/.ansible/tmp/ansible-tmp-1598275717.76-6642173712374/AnsiballZ_installp.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible_collections.ibm.power_aix.plugins.modules.installp', init_globals=None, run_name='main', alter_sys=True)
File "/opt/freeware/lib/python2.7/runpy.py", line 176, in run_module
fname, loader, pkg_name)
File "/opt/freeware/lib/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/opt/freeware/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/tmp/ansible_ibm.power_aix.installp_payload_enXNvv/ansible_ibm.power_aix.installp_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/installp.py", line 344, in
File "/tmp/ansible_ibm.power_aix.installp_payload_enXNvv/ansible_ibm.power_aix.installp_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/installp.py", line 282, in main
TypeError: 'NoneType' object is not iterable

Environment (please complete the following information):

  • OS: AIX 7.2 TL4
  • Python Version 2.7.5

unable to modify "login" and "rlogin" parameters with user module

hi

I use the following code in order to change "login" and "rlogin" attributes to "false":


  • name: MY PLAYBOOK
    hosts: LAB
    remote_user: ansible

    collections:

    • ibm.power_aix

    tasks:

    • name: change login and rlogin
      user:
      state: modify
      name: bin
      attributes:
      login: false
      rlogin: false

The ouput looks fine:
PLAY RECAP ***********************************************************************************************************************
myaix : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

But the attributes remain unchanged. Any idea?

Please add "removed" as a device state

Please add "removed" as a device state in devices.py to perform rmdev -dl

state:
description:
- Specifies the desired state of the device.
- C(available) configures device when its state is 'defined', otherwise it changes the device
attributes.
- C(defined) unconfigures/stops the device when its state is 'available', otherwise it changes
the device attributes.
type: str
choices: [ available, defined ]
default: available

doc: ibm/power_aix/modules/installp examples may refer to ansible's os/installp not ibm.power_aix

Describe the bug
ibm/power_aix/modules/installp examples may refer to ansible's os/installp not ibm.power_aix

To Reproduce
Steps to reproduce the behavior:

  1. https://ibm.github.io/ansible-power-aix/modules/installp.html
  2. Copy any example
  3. It works but then its actually using ansible's built-in OS module's installp, not ibm.power_aix.installp
  4. No error seen and User may mistakenly think that they are using ibm.power_aix.installp and may further get confused as os/installp and ibm.power_aix.installp arguments/parameters are way different.

Expected behavior
All examples should use fully qualified module path ( ibm.power_aix.installp )

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. AIX 7.2.4.0]
  • Python Version [e.g. 2.7.5, 3.6]
  • OpenSSH Version [e.g. 1.0.2]

Additional context
Add any other context about the problem here.

Bootstrap playbook failing due to corrupted yum_bundle.tar file

Describe the bug
We are using this collection for installing yum and python on AIX managed server.

To Reproduce
Steps to reproduce the behavior:
https://galaxy.ansible.com/ibm/power_aix
Downloaded tar file from ansible galaxy

Update ansible.cfg file and inventory file according to my env

After that the playbook execution is failing with below error

[root@p208n149 bootstrap]# ansible-playbook bootstrap.yml

PLAY [Bootstrap Yum on AIX] *******************************************************************************************************************************************

TASK [power_aix_bootstrap : Fail if pkgtype not specified] ************************************************************************************************************
skipping: [p227n243]

TASK [power_aix_bootstrap : Fail if download_dir not specified] *******************************************************************************************************
skipping: [p227n243]

TASK [power_aix_bootstrap : Fail if target_dir not specified] *********************************************************************************************************
skipping: [p227n243]

TASK [power_aix_bootstrap : Fail if rpm_src not specified] ************************************************************************************************************
skipping: [p227n243]

TASK [power_aix_bootstrap : Fail if yum_src not specified] ************************************************************************************************************
skipping: [p227n243]

TASK [power_aix_bootstrap : Bootstrap yum] ****************************************************************************************************************************
included: /root/bhar/bootstrap/power_aix/roles/power_aix_bootstrap/tasks/yum_install.yml for p227n243

TASK [power_aix_bootstrap : Check for existence of yum] ***************************************************************************************************************
changed: [p227n243]

TASK [power_aix_bootstrap : Check for rpm_src file on localhost] ******************************************************************************************************
ok: [p227n243]

TASK [power_aix_bootstrap : Download latest rpm (installp) fileset] ***************************************************************************************************
changed: [p227n243]

TASK [power_aix_bootstrap : Check for yum_src file on localhost] ******************************************************************************************************
ok: [p227n243]

TASK [power_aix_bootstrap : Download yum bundle file] *****************************************************************************************************************
changed: [p227n243]

TASK [power_aix_bootstrap : Check for script file on localhost] *******************************************************************************************************
ok: [p227n243]

TASK [power_aix_bootstrap : Copy the installer script file] ***********************************************************************************************************
changed: [p227n243]

TASK [power_aix_bootstrap : Check for target directory] ***************************************************************************************************************
changed: [p227n243]

TASK [power_aix_bootstrap : Check for target yum bundle] **************************************************************************************************************
skipping: [p227n243]

TASK [power_aix_bootstrap : Create target filesystem for image transfer] **********************************************************************************************
changed: [p227n243]

TASK [power_aix_bootstrap : Mount target filesystem] ******************************************************************************************************************
changed: [p227n243]

TASK [power_aix_bootstrap : Transfer install images] ******************************************************************************************************************
changed: [p227n243]

TASK [power_aix_bootstrap : Restore yum bundle content] ***************************************************************************************************************
changed: [p227n243]

TASK [power_aix_bootstrap : Remove temporary storage space] ***********************************************************************************************************
changed: [p227n243]

TASK [power_aix_bootstrap : Print status] *****************************************************************************************************************************
ok: [p227n243] => {
"msg": "Bootstrap attempt of yum on p227n243 has completed"
}

TASK [power_aix_bootstrap : Bootstrap python] *************************************************************************************************************************
skipping: [p227n243]

PLAY [Bootstrap Python on AIX] ****************************************************************************************************************************************

TASK [power_aix_bootstrap : Fail if pkgtype not specified] ************************************************************************************************************
skipping: [p227n243]

TASK [power_aix_bootstrap : Fail if download_dir not specified] *******************************************************************************************************
skipping: [p227n243]

TASK [power_aix_bootstrap : Fail if target_dir not specified] *********************************************************************************************************
skipping: [p227n243]

TASK [power_aix_bootstrap : Fail if rpm_src not specified] ************************************************************************************************************
skipping: [p227n243]

TASK [power_aix_bootstrap : Fail if yum_src not specified] ************************************************************************************************************
skipping: [p227n243]

TASK [power_aix_bootstrap : Bootstrap yum] ****************************************************************************************************************************
skipping: [p227n243]

TASK [power_aix_bootstrap : Bootstrap python] *************************************************************************************************************************
fatal: [p227n243]: FAILED! => {"reason": "couldn't resolve module/action 'ibm.power_aix.filesystem'. This often indicates a misspelling, missing collection, or incorrect module path.\n\nThe error appears to be in '/root/bhar/bootstrap/power_aix/roles/power_aix_bootstrap/tasks/python_install.yml': line 13, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n# EXPAND target paths\n - name: Expand /var target directory (+100M)\n ^ here\n"}

PLAY RECAP ************************************************************************************************************************************************************
p227n243 : ok=15 changed=10 unreachable=0 failed=1 skipped=13 rescued=0 ignored=0

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. AIX 7.2.4.0]
  • Python Version [e.g. 2.7.5, 3.6]
  • OpenSSH Version [e.g. 1.0.2]

Additional context
Add any other context about the problem here.

module setup, failed when running a playbook

Control node: Ansible 2.9
Ansible Endpoint: AIX 7.2, Python 2.7

Error: module setup, failed when running a playbook

[autom@ansible playbooks]$ ansible-playbook yum-conf.yml
[WARNING]: running playbook inside collection ibm.power_aix

PLAY [aix72] ******************************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************************
[WARNING]: Module invocation had junk after the JSON data: usage: sudo -e [-kS] [-p prompt] [-u username|#uid] file ...

fatal: [aix72]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"setup": {"failed": true, "module_stderr": "Shared connection to aix72 closed.\r\n", "module_stdout": "sudo: illegal option `-n'\r\nusage: sudo -h | -K | -k | -L | -l | -V | -v\r\nusage: sudo [-bEHkPS] [-p prompt] [-u username|#uid] [VAR=value]\r\n {-i | -s | }\r\nusage: sudo -e [-kS] [-p prompt] [-u username|#uid] file ...\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}}, "msg": "The following modules failed to execute: setup\n"}

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

[autom@ansible playbooks]$ cat yum-conf.yml

  • hosts: aix72
    gather_facts: yes
    become: yes
    collections:

    • ibm.power_aix
  • tasks:

    • name: Copy yum.conf
      copy:
      src: yum.conf
      dest: /opt/freeware/etc/yum/yum.conf
      owner: root
      group: system
      mode: '0644'
      register: copyf
    • name: check copy
      debug:
      msg: "{{ copyf }}"

"Request failed: <urlopen error unknown url type: https>"

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error
  5. fatal: [servername.domain.com]: FAILED! => {"changed": false, "dest": "/var/opt/ansible/GTS/tools/ConfigMergeTool.jar", "elapsed":, 0, "msg": "Request failed: ", "url": "https://XX.XX.XX.XX:8081/repository/GCM/tools/ConfigMergeTool.jar"}

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. AIX 7.2.4.0]
  • Python Version: [e.g. 2.7.5, 3.6]
  • OpenSSH Version: [e.g. 1.0.2]
  • Ansible Version: [e.g. 2.10.7]
  • AIX Collection Version: [e.g. 1.2.1]

Additional context
Add any other context about the problem here.

lvol module unable to change the number of copies of an existing lv

Describe the bug
lvol module is using either mklv or chlv commands, however to change the copies of an existing lv, mklvcopy command is needed

To Reproduce

  - name: add lv copy
    ibm.power_aix.lvol:
      vg: rootvg
      lv: hd2
      copies: 2
      state: present
    register: output

  - debug:
      var: output

Expected behavior
number of copies should be increased

Environment (please complete the following information):

  • OS: AIX 7.2.5.1]
  • Python Version: 3.8.2
  • OpenSSH Version: 1.0.2u
  • Ansible Version: 1.0.2u
  • AIX Collection Version: 1.2.1

Additional context
TASK result is OK, even though the requested change is not done:

ok: [test_host] => {
    "output": {
        "changed": true,
        "cmd": "chlv -e x  hd2",
        "failed": false,
        "msg": "Logical volume hd2 modified.",
        "rc": 0,
        "stderr": "",
        "stderr_lines": [],
        "stdout": "",
        "stdout_lines": []
    }
}

To fix master_setup and nim_maint issues in nim module

  1. master_setup task fails when it was triggered from playbook.
    the precheck of nim module calls the lsnim command which is not available until master setup is done. The precheck should be skipped when master_setup is called.

  2. nim_maint function calls an unsupported meta structure, need to switch to the supported structure

Modify attributes with boolean value does not work, if boolean value is not lowercase and in quotation marks

Describe the bug
In AIX 7.2.0.0 (and probably before) the command 'chuser account_locked=True ' returns 0 but do not change the attribute (lock the user). Same with 'False'. This will be reported shortly to IBM AIX development.
Even the usage of lowercase true/false does not work, as Ansible changes to uppercase True/False if not in quotation marks.
Therefore ibm.power_aix.user shows success, but the attribute is not changed.
I do report the error, as it should be available as a hint in the documentation (it is not an error within the collection).

To Reproduce
Steps to reproduce the behavior:

  1. run the following task to an existing unlocked :
- name: 'user <username>'
  ibm.power_aix.user:
    name: '<username>'
    state: 'modify'
    attributes:
      account_locked: true
  1. The module reports success.
  2. Check the users attributes with lsuser <username>. You will find, that account_locked is still false as it should be true.
  3. run the following task to the same still unlocked :
- name: 'user <username>'
  ibm.power_aix.user:
    name: '<username>'
    state: 'modify'
    attributes:
      account_locked: 'true'
  1. The module reports success.
  2. lsuser <username> now shows the correct value.

Screenshots

root@iuts531p:/root> oslevel
7.2.0.0
root@iuts531p:/root> lsuser grogu
grogu id=9999 pgrp=staff groups=staff,glogin,ansible home=/home/grogu shell=/usr/bin/ksh gecos=grogu (star wars),tel.+00-000-00-00042,R2-D2,,[email protected] login=true su=true rlogin=true daemon=true admin=false sugroups=ALL admgroups= tpath=nosak ttys=ALL expires=0 auth1=SYSTEM auth2=NONE umask=27 registry=files SYSTEM=compat logintimes= loginretries=3 pwdwarntime=5 account_locked=false minage=1 maxage=13 maxexpired=2 minalpha=2 minloweralpha=1 minupperalpha=1 minother=2 mindigit=1 minspecialchar=1 mindiff=4 maxrepeats=2 minlen=8 histexpire=13 histsize=10 pwdchecks= dictionlist= core_pathname=/root default_roles= fsize=2097151 cpu=-1 data=262144 stack=65536 core=2097151 rss=65536 nofiles=2000 unsuccessful_login_count=2 roles=
root@iuts531p:/root> chuser account_locked=True grogu
root@iuts531p:/root> lsuser grogu
grogu id=9999 pgrp=staff groups=staff,glogin,ansible home=/home/grogu shell=/usr/bin/ksh gecos=grogu (star wars),tel.+00-000-00-00042,R2-D2,,[email protected] login=true su=true rlogin=true daemon=true admin=false sugroups=ALL admgroups= tpath=nosak ttys=ALL expires=0 auth1=SYSTEM auth2=NONE umask=27 registry=files SYSTEM=compat logintimes= loginretries=3 pwdwarntime=5 account_locked=false minage=1 maxage=13 maxexpired=2 minalpha=2 minloweralpha=1 minupperalpha=1 minother=2 mindigit=1 minspecialchar=1 mindiff=4 maxrepeats=2 minlen=8 histexpire=13 histsize=10 pwdchecks= dictionlist= core_pathname=/root default_roles= fsize=2097151 cpu=-1 data=262144 stack=65536 core=2097151 rss=65536 nofiles=2000 unsuccessful_login_count=2 roles=
root@iuts531p:/root> chuser account_locked=true grogu
root@iuts531p:/root> lsuser grogu
grogu id=9999 pgrp=staff groups=staff,glogin,ansible home=/home/grogu shell=/usr/bin/ksh gecos=grogu (star wars),tel.+00-000-00-00042,R2-D2,,[email protected] login=true su=true rlogin=true daemon=true admin=false sugroups=ALL admgroups= tpath=nosak ttys=ALL expires=0 auth1=SYSTEM auth2=NONE umask=27 registry=files SYSTEM=compat logintimes= loginretries=3 pwdwarntime=5 account_locked=true minage=1 maxage=13 maxexpired=2 minalpha=2 minloweralpha=1 minupperalpha=1 minother=2 mindigit=1 minspecialchar=1 mindiff=4 maxrepeats=2 minlen=8 histexpire=13 histsize=10 pwdchecks= dictionlist= core_pathname=/root default_roles= fsize=2097151 cpu=-1 data=262144 stack=65536 core=2097151 rss=65536 nofiles=2000 unsuccessful_login_count=2 roles=

Environment (please complete the following information):

(two different managed hosts)

  • OS: [AIX 7.2.0.0]
  • Python Version: [2.7.16; 3.9.1.0]
  • OpenSSH Version: [7.5.102.2000; 8.1.102.2101]
  • Ansible Version: [e.g. 2.9.19]
  • AIX Collection Version: [1.2.1]

Additional context
If you need more information, feel free to contact me internally (Oliver Knopf at IBM-Germany).
Thanks for you great work.

power_aix_bootstrap should use ansible_host, ansible_password, etc.

NB: I really thought I already opened an issue for this the other day, but it doesn't seem to exist (open or closed). I apologize if this is a duplicate!

Is your feature request related to a problem? Please describe.
The power_aix_bootstrap role has to copy file to the target in order to install YUM and it's dependencies. This can cause the play to stop and wait for password entry, or to fail if the target is not resolvable. Ansible already handles these situations internally, but does not provide an obvious way to copy a file to a target without having Python installed on the target.

Describe the solution you'd like
The role should use a copy equivalent of the raw module, so that it would automatically have the same behavior as the rest of Ansible. Ansible does not provide such an action, so one is implemented in PR #104.

Describe alternatives you've considered
I looked at implementing all (well, most) of the ansible_* variables I need in the tasks of the role, but it got out of hand very quickly. The result would not be readable or easily maintained.

Additional context
I'm building clusters of AIX systems from bare metal up using Ansible, and it's not feasible to look up and type in 64 randomly generated root passwords every time we re-build. Also, the machines work for us. :)

lvg module fails for non Scalable vgs

Describe the bug
When modifying a VG, -M switch is presumably implicitly added. This switch is invalid for small or big VG. Extending rootvg fails.

To Reproduce
Steps to reproduce the behavior:
- name: Extend rootvg ibm.power_aix.lvg: vg_name: rootvg pvs: hdisk0 state: present

Expected behavior
VG is extended and returns changed. Currently, rootvg is extended, but the modules subsequently fails.

FAILED! => {"changed": false, "cmd": "chvg -M n rootvg ", "msg": "Volume group rootvg extended.\nFailed to modify volume group rootvg attributes. Command 'chvg -M n rootvg ' failed.", "rc": 2, "stderr": "0516-1616 chvg: This operation is only valid for scalable volume groups.\n0516-732 chvg: Unable to change volume group rootvg.\n", "stderr_lines": ["0516-1616 chvg: This operation is only valid for scalable volume groups.", "0516-732 chvg: Unable to change volume group rootvg."], "stdout": "", "stdout_lines": []}

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: AIX 7.2.4.1
  • Python Version: 3.8.2
  • OpenSSH Version: OpenSSH_7.1p1
  • Ansible Version: 2.10.3
  • AIX Collection Version: 1.2.1

Additional context
Add any other context about the problem here.

Step by step guide

Is your feature request related to a problem? Please describe.
Users are frustrated that there is not a step by step guide to get them rolling. There is one on installation, but an in-depth walk-through from installation to running a playbook would be useful. Not completely comprehensive, but beyond a quick start.

Describe the solution you'd like

A beginning to end playbook guide for a new user. Step by step from ansible download through adding collection and configuration to playbook execution on managed nodes.

Describe alternatives you've considered
Users are using example playbooks and referencing current docs, but it's time consuming piecing it all together.

lvol module fails when strip size not specified

The lvol module fails to create a LV if a strip size is not specified:
fatal: [server]: FAILED! => {"changed": false, "cmd": "mklv -t jfs2 -y test_lv -c 1 -e x -S None aixvg 64 ", "msg": "Failed to create logical volume test_lv in volume group volume_group. Command 'mklv -t jfs2 -y test_lv -c 1 -e x -S None volume_group 64 ' failed.", "rc": 1, "stderr": "0516-1435 mklv: The -S parameter for stripe size must be a power\n\tof 2. (ex: 4K, 8K, 16K, 32K, 64K, 128K...1M, 2M...128M) \n", "stderr_lines": ["0516-1435 mklv: The -S parameter for stripe size must be a power", "\tof 2. (ex: 4K, 8K, 16K, 32K, 64K, 128K...1M, 2M...128M) "], "stdout": "", "stdout_lines": []}

can't find user module

There is user module in the document here.
But ibm.power_aix collections 1.0.2 has no user module.
Where is the user module for aix?

Add non-striped LVs to lvol2 module

The lvol.py module only allows striped LVs to be created:


  • name: create a logical volume and filesystem
    hosts: my-new-vm
    tasks:
    • name: create a Logical Volume
      ibm.power_aix.lvol:
      state=present
      vg=datavg
      lv=testlv
      lv_type=jfs2
      num_of_logical_partitions=10

fatal: [my-new-vm]: FAILED! => {"changed": false, "cmd": "mklv -t jfs2 -y testlv -c 1 -e x -S None datavg 10 ", "msg": "Failed to create logical volume testlv in volume group datavg. Command 'mklv -t jfs2 -y testlv -c 1 -e x -S None datavg 10 ' failed.", "rc": 1, "stderr": "0516-1435 mklv: The -S parameter for stripe size must be a power\n\tof 2. (ex: 4K, 8K, 16K, 32K, 64K, 128K...1M, 2M...128M) \n", "stderr_lines": ["0516-1435 mklv: The -S parameter for stripe size must be a power", "\tof 2. (ex: 4K, 8K, 16K, 32K, 64K, 128K...1M, 2M...128M) "], "stdout": "", "stdout_lines": []}

The "-S" flag should be optional, and does not stand for "size", but for "stripe size". I changed the lvol.py module to change size into stripe, and made it optional. attached is the new version:
lvol.txt

reboot module fails when specifying pre_reboot_delay in ad-hoc ansible command

When I run:

ansible aix01 -m ibm.power_aix.reboot -a "pre_reboot_delay=20 post_reboot_delay=20 reboot_timeout=450 test_command=uname" -bK

I receive the following error:

An exception occurred during task execution. To see the full traceback, use -vvv. **The error was: TypeError: an integer is required (got type str)**
aix01 | FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""

If I run the command again but remove pre_reboot_delay I do not receive an error:

ansible aix01 -m ibm.power_aix.reboot -a "post_reboot_delay=20 reboot_timeout=450 test_command=uname" -bK

Is there anything specific I need to do to get pre_reboot_delay to work when using an ad-hoc ansible command?

Ansible and Collection version in bug report template

Is your feature request related to a problem? Please describe.
Toubleshooting of error messages isn't easy if we don't know the used Ansible and Collection version.

Describe the solution you'd like
Add Ansible and Collection version to the bug report template to improve the troubleshooting of bugs.

Describe alternatives you've considered
None

Additional context
None

Make emgr interim fix installation idempotent

Is your feature request related to a problem? Please describe.
I tried installing an interim fix with the install action from the emgr module. It handled the installation of the new openssl_fix32 interim fix just fine, but if you run the playbook against the same host more than once, it errors.

Describe the solution you'd like
Ideally this should be idempotent -- you should be able to run this against the same host multiple times. Once the interim fix is installed, the install method should know that it is and not throw an error. Either you could do that by using a construction like "installed: true") similar to Ansible's built-in service module) rather than action: install, or just make sure the install action checks to see if an interim fix is installed before it tries to run "emgr -e <fix_file>".

Describe alternatives you've considered
As is -- without idempotence -- I'm not sure this has a lot of advantages over my usual NIM script strategy.

Additional context
I hope this doesn't come across to critical -- I'm definitely very happy to see this collection being developed!

Reboot module in a playbook does not complete for 2 hours

When we use the aix reboot module in a playbook, it did the reboot successfully of the target but the playbook does not complete till 2 hours later.

We tried various reboot_timeout values and it did not help.

Faad


  • name: reboot aix systems
    hosts: aix

gather_facts: false

tasks:
- name: "Reboot a machine"
ibm.power_aix.reboot:
pre_reboot_delay: 30
post_reboot_delay: 10
reboot_timeout: 100

AWX - ibm.power_aix.nim_suma - AttributeError: 'NoneType' object has no attribute 'group'

Describe the bug
When running nim_suma against a specific AIX 7.1 node via AWX the nim_suma.py code errors out with

AttributeError: 'NoneType' object has no attribute 'group'

To Reproduce
Use the following .yml and replace with one you have

`---

  • name: "Run Service Update Management Assistant (SUMA) on AIX"
    hosts: all
    gather_facts: true

    tasks:

    • name: Check NIM for resources
      ibm.power_aix.nim_suma:
      action: preview
      targets:
      oslevel: Latest`

This will then generate the following:

Identity added: /tmp/bwrap_48_87hq4ee6/awx_48_6o6isp5l/artifacts/48/ssh_key_data (/tmp/bwrap_48_87hq4ee6/awx_48_6o6isp5l/artifacts/48/ssh_key_data) PLAY [Run Service Update Management Assistant (SUMA) on AIX] ******************* TASK [Gathering Facts] ********************************************************* [WARNING]: Platform aix on host xyz is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See https://docs.ansible.com/ansible/2.9/referen ce_appendices/interpreter_discovery.html for more information. ok: [xyz] TASK [Check NIM for resources] ************************************************* An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'NoneType' object has no attribute 'group' fatal: [xyz]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 102, in <module>\n File \"<stdin>\", line 94, in _ansiballz_main\n File \"<stdin>\", line 40, in invoke_module\n File \"/opt/freeware/lib/python2.7/runpy.py\", line 188, in run_module\n fname, loader, pkg_name)\n File \"/opt/freeware/lib/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File \"/opt/freeware/lib/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/tmp/ansible_ibm.power_aix.nim_suma_payload_Bex85_/ansible_ibm.power_aix.nim_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/nim_suma.py\", line 1083, in <module>\n File \"/tmp/ansible_ibm.power_aix.nim_suma_payload_Bex85_/ansible_ibm.power_โ€ฆ PLAY RECAP *********************************************************************xyz : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
module_stderr contains the following

"module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 102, in <module>\n File \"<stdin>\", line 94, in _ansiballz_main\n File \"<stdin>\", line 40, in invoke_module\n File \"/opt/freeware/lib/python2.7/runpy.py\", line 188, in run_module\n fname, loader, pkg_name)\n File \"/opt/freeware/lib/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File \"/opt/freeware/lib/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/tmp/ansible_ibm.power_aix.nim_suma_payload_Bex85_/ansible_ibm.power_aix.nim_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/nim_suma.py\", line 1083, in <module>\n File \"/tmp/ansible_ibm.power_aix.nim_suma_payload_Bex85_/ansible_ibm.power_aix.nim_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/nim_suma.py\", line 1072, in main\n File \"/tmp/ansible_ibm.power_aix.nim_suma_payload_Bex85_/ansible_ibm.power_aix.nim_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/nim_suma.py\", line 879, in suma_download\n File \"/tmp/ansible_ibm.power_aix.nim_suma_payload_Bex85_/ansible_ibm.power_aix.nim_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/nim_suma.py\", line 546, in compute_rq_name\nAttributeError: 'NoneType' object has no attribute 'group'\n", "exception": "Traceback (most recent call last):\n File \"<stdin>\", line 102, in <module>\n File \"<stdin>\", line 94, in _ansiballz_main\n File \"<stdin>\", line 40, in invoke_module\n File \"/opt/freeware/lib/python2.7/runpy.py\", line 188, in run_module\n fname, loader, pkg_name)\n File \"/opt/freeware/lib/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File \"/opt/freeware/lib/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/tmp/ansible_ibm.power_aix.nim_suma_payload_Bex85_/ansible_ibm.power_aix.nim_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/nim_suma.py\", line 1083, in <module>\n File \"/tmp/ansible_ibm.power_aix.nim_suma_payload_Bex85_/ansible_ibm.power_aix.nim_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/nim_suma.py\", line 1072, in main\n File \"/tmp/ansible_ibm.power_aix.nim_suma_payload_Bex85_/ansible_ibm.power_aix.nim_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/nim_suma.py\", line 879, in suma_download\n File \"/tmp/ansible_ibm.power_aix.nim_suma_payload_Bex85_/ansible_ibm.power_aix.nim_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/nim_suma.py\", line 546, in compute_rq_name\nAttributeError: 'NoneType' object has no attribute 'group'\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1, "_ansible_no_log": false, "changed": false }

Expected behavior
Return TL / SP details of target(s).

Screenshots
N/A

Environment (please complete the following information):

  • OS: Host/NIM (AIX 7200-03-02-1845), Node (AIX 7100-05-05-1939)
  • Python Version: 2.7
  • OpenSSH Version: Host/NIM (1.0.2.2100), Node (1.0.2.1801)
  • Ansible Version: 2.9
  • AIX Collection Version: 1.2.1

Additional context
N/A

Optionally avoid rebooting target for bos_inst

Is your feature request related to a problem? Please describe.
Currently, all attempts to perform a bos_inst operation will cause the NIM server to attempt to reboot the client. This results in a long delay when the client doesn't exist yet, and prevents staging a bos_inst operation for a later time.

Describe the solution you'd like
The module relies on the default behavior of the NIM server (which I think is correct), but needs a way to pass the attribute to alter that behavior.

SMTCTL

Hi,
Good Day

I've written a Ansible module for smtctl (multithreading) for Power8 and Power9. I've tested and it is working fine.
Just wondering whether i can contribute to ibm.power_aix.

Please suggest.

Thanks
Madhu

Creating a new user with specific pgrp ID does not update the ownership of the home directory.

When using ibm.power_aix.user state=present to build a new user along with the a pgrp attribute, the home directory appears to be created with another user id as owner.

  1. Playbook/vars to recreate:

vars:
user_name: ansible
user_id: 999

- name: Add user to AIX VM - skip if home directory exists or is wrong OS
  ibm.power_aix.user:
    state: present
    name: "{{ user_name }}"
    attributes:
      id: "{{ user_id }}"

  1. Expected outcome:
    To see the home directory owned by the user

  2. Outcome:
    Directory is owned by ID 211
    [root@sc-tower-2 playbooks]# ssh root@lab-aix-1 ls -l /home
    drwxr-xr-x 2 211 staff 256 Dec 08 09:50 ansible

We can see its owner is ID 211 - I think this was the next UID in sequence. So maybe the user ID gets created with with next ID in sequence (211) then changed to the required ID (999), however the home directory has already been created with ID 211

[root@sc-tower-2 playbooks]# ssh root@lab-aix-1 cat /etc/passwd | grep ansible
ansible:*:999:1::/home/ansible:/usr/bin/ksh

Shows that the userid is correct.

Creating custom privileged group

Describe the bug
Not a bug, but I was asked to raise questions here

To Reproduce
I want to use ansible to run some custom automation on VIOS appliances. The ansible user will need access to the /var/opt/ansible directory (and its subdirectories).

To achieve this, I believe that the ansible user will need to be in a new privileged group with rights to that directory.

Is this approach compliant with VIOS support?

If so, what commands should I user to create this ansible group, make it privileged and assign the ansible user to it?
If not, what compliant approach would achieve the same end result?

Thanks

nim_vios_hc.py errors

Running ansible 2.9 on python 3.6.8
encountering errors when running playbook with nim_vios_hc.py module

Error:
[root@POWERVCLAB1 aix]# ansible-playbook vios_hc.yml

PLAY [VIOS health check playbook] **************************************************************************************

TASK [execute power_aix_vioshc role] ***********************************************************************************

TASK [ibm.power_aix.power_aix_vioshc : Install vioshc.py onto target] **************************************************
ok: [smopwrnimlab]

TASK [Perform a health check on VIOS] **********************************************************************************
fatal: [smopwrnimlab]: FAILED! => changed=false
msg: 'Failed to get the VIOS information, vioshc returned: 3'
stderr: ''
stderr_lines:
stdout: |-
ERROR: Failed to get NIM name for smocopwrhmc1.jhacorp.com: Not Found
stdout_lines:

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

log file from nim server:

pg vioshc_2020_09_24_161005.log

################################################################################
vioshc log file for command:
['/usr/sbin/vioshc.py', '-i', 'smocopwrhmc1', '-l', 'a']
################################################################################

Parsing command line arguments
PID=%(thread)d
Checking mandatory arguments
Getting HMC smocopwrhmc1 info
hmc smocopwrhmc1 hostname: smocopwrhmc1.jhacorp.com
command ['lsnim', '-a', 'if1'] returned:
rc:0
stdout:master:
if1 = network1 smopwrnimlab.jhacorp.com FAB958849820
smoansiblelab1:
if1 = network1 smoansiblelab1.jhacorp.com FAE465EA9220 ent0
smoansiblelab2:
if1 = network1 smoansiblelab2.jhacorp.com FAE3AD389820 ent0
smoansiblep1:
if1 = prodnet smoansiblep1 0
ansible-vm1:
if1 = network1 ansible-vm1 0
smoansiblep3:
if1 = prodnet smoansiblep3 0
ansible-vm2:
if1 = network1 ansible-vm2 0
smopwr7e2bvios2:
if1 = network1 smopwr7e2bvios2 0
smopwr7e2bvios1:
if1 = network1 smopwr7e2bvios1 0
smopwr7e1bvios1:
if1 = network1 smopwr7e1bvios1 0
smopwr7e1bvios2:
if1 = network1 smopwr7e1bvios2 0
smocopwrhmc1:
if1 = ent-Network1 smocopwrhmc1 0 ent

stderr:
ERROR: Failed to get NIM name for smocopwrhmc1.jhacorp.com: Not Found
hmc smocopwrhmc1.jhacorp.com nim_name:

here is the what the hmc object looks like on the nim server:

lsnim -l smocopwrhmc1

smocopwrhmc1:
class = management
type = hmc
passwd_file = /etc/sysmgt/dsm/config/smocopwrhmc1
manages = 7895-42X_1067E1B
manages = 7895-42X_1067E2B
login = KVanGogh
mgmt_port = 12443
if1 = ent-Network1 smocopwrhmc1.jhacorp.com 0 ent
Cstate = ready for a NIM operation
prev_state = ready for a NIM operation
Mstate = currently running

ansible-ibm.power_aix.flrtvc module need to ensure it uses https for download

Describe the bug
ansible-ibm.power_aix.flrtvc module picks up ftp as default protocol for downloading files. ftp is not an option for us. We need a way to specify the desired transport protocol. Would need to ensure that flrtvc uses https protocol to download fixes. How do we do this?

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. AIX 7.2.4.0]
  • Python Version [e.g. 2.7.5, 3.6]
  • OpenSSH Version [e.g. 1.0.2]

Additional context
Add any other context about the problem here.

devices module not always idempotent

Describe the bug
When using devices module to remove a route which doesn't exist, the module fails

To Reproduce
Steps to reproduce the behavior:
- name: Remove erroneous default gateway ibm.power_aix.devices: device: inet0 state: available attributes: delroute: ",-hopcount,0,,,,,,-static,0,0.0.0.0"

Expected behavior
If the route exists, it is removed. If it doesn't exist, module should return OK instead of FAILED

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: AIX 7.2.4.1
  • Python Version: 3.8.2
  • OpenSSH Version: OpenSSH_7.1p1
  • Ansible Version: 2.10.3
  • AIX Collection Version: 1.2.1

Additional context
Add any other context about the problem here.

error running module suma.py AttributeError: 'tuple' object has no attribute 'rstrip'

After applying suggested fix (a382be1)

error when running the same playbook calling suma.py module to update tl levels on aix endpoint

Error details:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'tuple' object has no attribute 'rstrip'
fatal: [ansible-vm1]: FAILED! => changed=false
module_stderr: |-
Shared connection to ansible-vm1 closed.
module_stdout: |-
Traceback (most recent call last):
File "/.ansible/tmp/ansible-tmp-1600983454.4765153-6132-213536560555233/AnsiballZ_suma.py", line 102, in
_ansiballz_main()
File "/.ansible/tmp/ansible-tmp-1600983454.4765153-6132-213536560555233/AnsiballZ_suma.py", line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/.ansible/tmp/ansible-tmp-1600983454.4765153-6132-213536560555233/AnsiballZ_suma.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible_collections.ibm.power_aix.plugins.modules.suma', init_globals=None, run_name='main', alter_sys=True)
File "/opt/freeware/lib/python2.7/runpy.py", line 176, in run_module
fname, loader, pkg_name)
File "/opt/freeware/lib/python2.7/runpy.py", line 82, in _run_module_code
mod_name, mod_fname, mod_loader, pkg_name)
File "/opt/freeware/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/tmp/ansible_suma_payload_iyhBnT/ansible_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/suma.py", line 869, in
File "/tmp/ansible_suma_payload_iyhBnT/ansible_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/suma.py", line 859, in main
File "/tmp/ansible_suma_payload_iyhBnT/ansible_suma_payload.zip/ansible_collections/ibm/power_aix/plugins/modules/suma.py", line 676, in suma_download
AttributeError: 'tuple' object has no attribute 'rstrip'
msg: |-
MODULE FAILURE
See stdout/stderr for the exact error
rc: 1

PLAY RECAP *************************************************************************************************************
ansible-vm1 : ok=3 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.