HMC

 View Only
  • 1.  ANSIBLE powervm_inventory

    Posted Wed February 07, 2024 10:38 AM

    Hello All,

    I have an ansible control node (RedHat 9.2) using :

    ansible [core 2.14.2]
      config file = /home/ansible/ansible.cfg
      configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
      ansible python module location = /usr/lib/python3.11/site-packages/ansible
      ansible collection location = /home/ansible/collections:/home/ansible/.ansible/collections:/usr/share/ansible.collections:/home/ansible/colections/ansible_collections/community/general
      executable location = /usr/bin/ansible
      python version = 3.11.2 (main, Sep 12 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python3.11)
      jinja version = 3.1.2
      libyaml = True

    I installed the collection : ibm.power_hmc     1.8.2

    and tried to create a dynamic inventory as below:

    plugin: ibm.power_hmc.powervm_inventory
    hmc_hosts:
      - hmc: <hostname>
        user: <user>
        password: pass
    filters:
       PartitionState: 'running'

    After running: ansible-inventory -i myhmc.power_hmc.yaml --list

     [WARNING]: Unable to connect to HMC host {'hmc': 'hostname', 'user': 'user', 'password': 'pass'}: Error: Missing prerequisite lxml package.
    Hint pip install lxml

    [WARNING]:  * Failed to parse /home/ansible/myhmc.power_hmc.yaml with auto plugin: There are no systems defined to any valid HMCs provided or no valid
    connections were established.
    [WARNING]:  * Failed to parse /home/ansible/myhmc.power_hmc.yaml with yaml plugin: Plugin configuration YAML file, not YAML inventory
    [WARNING]:  * Failed to parse /home/ansible/myhmc.power_hmc.yaml with ini plugin: Invalid host pattern 'plugin:' supplied, ending in ':' is not allowed,
    this character is reserved to provide a port.
    [WARNING]: Unable to parse /home/ansible/myhmc.power_hmc.yaml as an inventory source
    [WARNING]: No inventory was parsed, only implicit localhost is available
    {
        "_meta": {
            "hostvars": {}
        },
        "all": {
            "children": [
                "ungrouped"
            ]
        }
    }

    To my understanding the lxml is missing . The python default version is python3.9 , which has the lxml

    The python ansible uses is python3.11 which does not have the lxml

    Any suggestions on how to overcome this error?

    Thank you in advance



    ------------------------------
    EVANGELOS VARTHALAMIS
    ------------------------------


  • 2.  RE: ANSIBLE powervm_inventory

    IBM Champion
    Posted Thu February 08, 2024 04:32 AM

    Evangelos,

    Hi, good day to you.

    I found that the following needed to be installed first.

    dnf install libxml2-devel libxslt-devel python3-devel gcc

    In addition, as you have mentioned, lxml is also required.

    python3 -m pip install lxml

    And finally, you will need to add "ibm.power_hmc.powervm_inventory" to both the "enable inventory plugins" and "enable_plugins" lines in ansible.cfg

    [inventory]
    enable inventory plugins, default: 'host_list', 'script', 'auto', 'yaml', 'ini', 'toml', 'ibm.power_hmc.powervm_inventory'
    enable_plugins = host_list, script, auto, yaml, ini, toml, ibm.power_hmc.powervm_inventory

    Once I'd completed the above I was then able to generate a dynamic inventory.

    Hope that helps.

    Regards, Steve



    ------------------------------
    Steve Munday
    AIX, IBM i, HMC, PowerVM
    ------------------------------



  • 3.  RE: ANSIBLE powervm_inventory

    Posted Thu February 08, 2024 07:00 AM

    Hello Steve,

    Thank you for your response. I downloaded lxml for python 3.11 and installed it. 

    Also added the lines in ansible.cfg file

    The error now is the following :

    [WARNING]: Unable to connect to HMC host {'hmc': 'hostname', 'user': 'user', 'password': 'pass'}: URLError(TimeoutError(110, 'Connection timed out'))
    [WARNING]:  * Failed to parse /home/ansible/myhmc.power_hmc.yaml with auto plugin: There are no systems defined to any valid HMCs provided or no valid
    connections were established.
    [WARNING]:  * Failed to parse /home/ansible/myhmc.power_hmc.yaml with yaml plugin: Plugin configuration YAML file, not YAML inventory
    [WARNING]:  * Failed to parse /home/ansible/myhmc.power_hmc.yaml with ini plugin: Invalid host pattern 'plugin:' supplied, ending in ':' is not allowed,
    this character is reserved to provide a port.
    [WARNING]:  * Failed to parse /home/ansible/myhmc.power_hmc.yaml with ansible_collections.ibm.power_hmc.plugins.inventory.powervm_inventory plugin: There
    are no systems defined to any valid HMCs provided or no valid connections were established.
    [WARNING]: Unable to parse /home/ansible/myhmc.power_hmc.yaml as an inventory source
    [WARNING]: No inventory was parsed, only implicit localhost is available
    {
        "_meta": {
            "hostvars": {}
        },
        "all": {
            "children": [
                "ungrouped"
            ]
        }
    }



    ------------------------------
    EVANGELOS VARTHALAMIS
    ------------------------------



  • 4.  RE: ANSIBLE powervm_inventory

    IBM Champion
    Posted Thu February 08, 2024 07:32 AM

    Evangelos,

    Hi, are you able to successfully SSH to your target HMC from your Control Node using the credentials you've defined in the playbook?  Also, is the "user" on the HMC allowed to connect remotely?

    Thanks, Steve



    ------------------------------
    Steve Munday
    AIX, IBM i, HMC, PowerVM
    ------------------------------



  • 5.  RE: ANSIBLE powervm_inventory

    IBM Champion
    Posted Thu February 08, 2024 08:31 AM
    Edited by Steve Munday Thu February 08, 2024 08:47 AM

    Evangelos,

    Hi, I just tried to connect to an invalid HMC and get the following:

    [WARNING]: Unable to connect to HMC host {'hmc': 'hmc-name', 'user':
    'user-name', 'password': 'pass-word'}: URLError(TimeoutError(78,
    'Connection timed out'))

    Re-check HMC name(s) and user/password details to see if there's a typo in there somewhere.

    Also, have you tried running the command with -vvv at the end to get a more detailed debug?

    Thanks, Steve

    ------------------------------
    Steve Munday
    AIX, IBM i, HMC, PowerVM
    ------------------------------



  • 6.  RE: ANSIBLE powervm_inventory

    IBM Champion
    Posted Fri February 23, 2024 04:43 AM

    Evangelos,

    Hi, I was wondering if you'd managed to resolve your issue?

    Thanks, Steve



    ------------------------------
    Steve Munday
    AIX, IBM i, HMC, PowerVM
    ------------------------------