My purpose and issue.
when i test run alt_disk via Ansible by using demo playbook included in "ibm.power_aix" collection version 1.8.1.
from: https://galaxy.ansible.com/ui/repo/published/ibm/power_aix/distributions/
Ansible environment information.
Both AIX lpars were provision in IBM Tech Zone and both lpars were exprired.
1. AIX version for Ansible Control node & Ansible Managed node.
- Ansible Control node: p1290-pvm1 has the AIX oslevel of 7300-00-04-2320
- Ansible Managed node: p1290-pvm2 has the AIX oslevel of 7200-05-07-2346
2. Create new user (name: ckdevops) for run Ansible on both nodes with sudo settings.
ckdevops@p1290-pvm1:/home/ckdevops/ckdevps-2024-mar-ansible $ ansible --version
ansible [core 2.14.13]
config file = /home/ckdevops/ckdevps-2024-mar-ansible/ansible.cfg
configured module search path = ['/home/ckdevops/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /opt/freeware/lib/python3.9/site-packages/ansible
ansible collection location = /home/ckdevops/ckdevps-2024-mar-ansible/mycollections:/collections:/usr/share/ansible/collections
executable location = /opt/freeware/bin/ansible.orig
python version = 3.9.18 (main, Sep 19 2023, 04:57:07) [GCC 10.3.0] (/opt/freeware/bin/python3.9)
jinja version = 3.1.2
libyaml = True
ckdevops@p1290-pvm1:/home/ckdevops/ckdevps-2024-mar-ansible $
ckdevops@p1290-pvm2:/home/ckdevops $ sudo -l
User ckdevops may run the following commands on p1290-pvm2:
(ALL) NOPASSWD: ALL
ckdevops@p1290-pvm2:/home/ckdevops $
3. Inventory
ckdevops@p1290-pvm1:/home/ckdevops/ckdevps-2024-mar-ansible $ cat inventory
[aixcontrol]
###-localhost anisble_connection=local
###- OR
#p1290-pvm1.p1290.cecc.ihost.com ansible_connection=ssh ansible_user=cecuser ansible_ssh_private_key_file=~/.ssh/id_rsa
p1290-pvm1.p1290.cecc.ihost.com ansible_connection=ssh ansible_user=ckdevops ansible_ssh_private_key_file=~/.ssh/id_ed25519
[aixclients]
#p1290-pvm2.p1290.cecc.ihost.com ansible_connection=ssh ansible_user=cecuser ansible_ssh_private_key_file=~/.ssh/id_rsa
p1290-pvm2.p1290.cecc.ihost.com ansible_connection=ssh ansible_user=ckdevops ansible_ssh_private_key_file=~/.ssh/id_ed25519
[all:vars]
ansible_python_interpreter=/usr/bin/python
4. Collection installed.
ckdevops@p1290-pvm1:/home/ckdevops/ckdevps-2024-mar-ansible $ ansible-galaxy collection list
# /home/ckdevops/ckdevps-2024-mar-ansible/mycollections/ansible_collections
Collection Version
------------- -------
ibm.power_aix 1.8.1
Issue detail.
1. Playbook (modified)
# ck_demo_alt_disk.yml
---
- name: "ALT_DISK on AIX"
hosts: "{{host_name}}"
gather_facts: no
vars:
host_name: aixclients
targets: hdisk0
collections:
ibm.power_aix
tasks:
- name: Perform an alternate disk copy of the rootvg to hdisk0
alt_disk:
action: copy
targets: hdisk0
- name: Perform an alternate disk copy of the rootvg to the nearest disk that can be selected
alt_disk:
action: copy
disk_size_policy: nearest
allow_old_rootvg: yes
force: true
- name: Perform an alternate disk copy of the rootvg to the smallest disk that can be selected
alt_disk:
action: copy
disk_size_policy: minimize
- name: Perform a cleanup of any existing alternate disk copy
alt_disk:
action: clean
- name: Perform a cleanup of any existing alternate disk copy and old rootvg
alt_disk:
action: clean
allow_old_rootvg: yes
#- Run playbook.
ckdevops@p1290-pvm1:/home/ckdevops/ckdevps-2024-mar-ansible $ ansible-playbook playbooks/ck_demo_alt_disk.yml
PLAY [ALT_DISK on AIX] *****************************************************************************************************************************
TASK [Perform an alternate disk copy of the rootvg to hdisk0] **************************************************************************************
fatal: [p1290-pvm2.p1290.cecc.ihost.com]: FAILED! => {"changed": false, "cmd": "alt_disk_copy -d hdisk0 -B", "msg": "[Errno 2] No such file or directory", "rc": 2, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
PLAY RECAP *****************************************************************************************************************************************
p1290-pvm2.p1290.cecc.ihost.com : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
ckdevops@p1290-pvm1:/home/ckdevops/ckdevps-2024-mar-ansible $
Charin Kumjudpai.
IBMTH.
------------------------------
CHARIN KUMJUDPAI
------------------------------
#AIXOpenSource