AIX Open Source

AIX Open Source

Share your experiences and connect with fellow developers to discover how to build and manage open source software for the AIX operating system

 View Only
Expand all | Collapse all

Ansible for Power System issue when ran "ibm.power_aix.alt_disk" "cmd": "alt_disk_copy -d hdisk0 -B", "msg": "[Errno 2] No such file or directory", "rc": 2

  • 1.  Ansible for Power System issue when ran "ibm.power_aix.alt_disk" "cmd": "alt_disk_copy -d hdisk0 -B", "msg": "[Errno 2] No such file or directory", "rc": 2

    Posted Wed March 06, 2024 02:44 AM

    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
    ------------------------------


  • 2.  RE: Ansible for Power System issue when ran "ibm.power_aix.alt_disk" "cmd": "alt_disk_copy -d hdisk0 -B", "msg": "[Errno 2] No such file or directory", "rc": 2

    Posted Wed March 06, 2024 12:09 PM

    I would recommend to open an issue on https://github.com/IBM/ansible-power-aix/issues for ibm.power_aix collection.

     

    Thanks,

     

    Sanket Rathi

     






  • 3.  RE: Ansible for Power System issue when ran "ibm.power_aix.alt_disk" "cmd": "alt_disk_copy -d hdisk0 -B", "msg": "[Errno 2] No such file or directory", "rc": 2

    Posted Thu March 07, 2024 06:10 AM

    Hi Charin,

    the error message says that Ansible can't find alt_disk_copy command:

    "msg": "[Errno 2] No such file or directory"

    Check that you have the command on your server:

    # type alt_disk_copy
    alt_disk_copy is /usr/sbin/alt_disk_copy
    
    # lslpp -L bos.alt_disk_install.*
      Fileset                      Level  State  Type  Description (Uninstaller)
      ----------------------------------------------------------------------------
      bos.alt_disk_install.boot_images
                                 7.3.2.1    C     F    Alternate Disk Installation
                                                       Disk Boot Images 
      bos.alt_disk_install.rte   7.3.2.0    C     F    Alternate Disk Installation
                                                       Runtime 
    

    If you don't have it, install it first before using Ansible.

    Please consider opening Ansible-related topics in the new Power automation community



    ------------------------------
    Andrey Klyachkin

    https://www.power-devops.com
    ------------------------------



  • 4.  RE: Ansible for Power System issue when ran "ibm.power_aix.alt_disk" "cmd": "alt_disk_copy -d hdisk0 -B", "msg": "[Errno 2] No such file or directory", "rc": 2

    Posted Thu March 07, 2024 06:34 AM

    Hello Andrey Klyachkin,

    Thank you so much for your response in this community(It  could be better to raise issue in github).

    I would like to inform you to  know, both AIX lpars (Control & Manger nodes) were expired in IBM Tech zone Env.

    1. For your advice to run (# type alt_disk_copy and # lslpp -L bos.alt_disk_install.*)
        I could not run and share information to you.

    2. While i got these errors message, i am wondering about the "cmd": "alt_disk_copy -d hdisk0 -B" as well. 
        
        Herewith with detail as i ran on both Control node and Managed node.
        
        2.1 On control node (p1290-pvm1).
        
            ckdevops@p1290-pvm1:/home/ckdevops/ckdevps-2024-mar-ansible $ sudo alt_disk_copy -d hdisk0 -B
            Calling mkszfile to create new /image.data file.

            Failed to match the inode of ipldevice to any device. Explicitly pass boot device using -d as a workaround

            Failed to match the inode of ipldevice to any device. Explicitly pass boot device using -d as a workaround
            0505-121 alt_disk_install: Error.
            Cleaning up.
            ckdevops@p1290-pvm1:/home/ckdevops/ckdevps-2024-mar-ansible $ lspv
            hdisk0          none                                None
            hdisk1          00f9e0a01881cb17                    rootvg          active
            ckdevops@p1290-pvm1:/home/ckdevops/ckdevps-2024-mar-ansible $

        2.2 On managed node (p1290-pvm2).
        
            ckdevops@p1290-pvm2:/home/ckdevops $ lspv
            hdisk0          00c35450fda56469                    None
            hdisk1          00f9e0a0fe46202a                    rootvg          active
            ckdevops@p1290-pvm2:/home/ckdevops $


            ckdevops@p1290-pvm2:/home/ckdevops $ sudo alt_disk_copy -d hdisk0 -B
            sudo: alt_disk_copy: command not found
            ckdevops@p1290-pvm2:/home/ckdevops $

    That's why I am posted issue on IBM Community channel.

    Regards,
    Charin Kumjudpai.
    IBMTH.
        



    ------------------------------
    CHARIN KUMJUDPAI
    ------------------------------



  • 5.  RE: Ansible for Power System issue when ran "ibm.power_aix.alt_disk" "cmd": "alt_disk_copy -d hdisk0 -B", "msg": "[Errno 2] No such file or directory", "rc": 2

    Posted Thu March 07, 2024 08:56 AM

    Hi Charin,

    I don't follow you. If you can't share the information, you can open a case at IBM or because you are an IBMer, you can ask someone internally in IBM's slack.

    But as I expected you are missing the command alt_disk_copy on the managed node. Install it and it will solve your problem.



    ------------------------------
    Andrey Klyachkin

    https://www.power-devops.com
    ------------------------------