Power

 View Only
  • 1.  ansible-galaxy collection installation path / How to change it in the ansible.conf ?

    Posted Wed October 25, 2023 10:00 AM

    Hello,

    I have a question about   ansible-galaxy  collection installation path.

    I ran the installation a first time, but in the wrong path...   '/home/derouet/ is not a good choice...

    root@apaai001:/tmp/derouet #
    root@apaai001:/tmp/derouet # /opt/freeware/bin/ansible-galaxy collection install /tmp/derouet/ibm-power_aix-1.6.4.tar.gz
    Starting galaxy collection install process
    Process install dependency map
    Starting collection install process
    Installing 'ibm.power_aix:1.6.4' to '/home/derouet/.ansible/collections/ansible_collections/ibm/power_aix'
    ibm.power_aix:1.6.4 was installed successfully
    root@apaai001:/tmp/derouet #

    I ran the installation a second time, in the right path !  Is /home/ansible/  really a good choice ?

    root@apaai001:/tmp/derouet #
    root@apaai001:/tmp/derouet # /opt/freeware/bin/ansible-galaxy collection install /tmp/derouet/ibm-power_aix-1.6.4.tar.gz -p /home/ansible/collection/
    Starting galaxy collection install process
    [WARNING]: The specified collections path '/home/ansible/collection' is not part of the configured Ansible collections paths
    '/home/derouet/.ansible/collections:/usr/share/ansible/collections'. The installed collection will not be picked up in an Ansible run, unless within a playbook-adjacent collections
    directory.
    Process install dependency map
    Starting collection install process
    Installing 'ibm.power_aix:1.6.4' to '/home/ansible/collection/ansible_collections/ibm/power_aix'
    ibm.power_aix:1.6.4 was installed successfully
    root@apaai001:/tmp/derouet #

    I understand i have to update the ansible.cfg file.

    But when i have a look at it i can only see the "ssh connection" needed parameters...   Nothing about '/home/derouet/'...

    root@apaai001:/opt/freeware/etc/ansible # cat ansible.cfg
    # Since Ansible 2.12 (core):
    # To generate an example config file (a "disabled" one with all default settings, commented out):
    #               $ ansible-config init --disabled > ansible.cfg
    #
    # Also you can now have a more complete file by including existing plugins:
    # ansible-config init --disabled -t all > ansible.cfg

    # For previous versions of Ansible you can check for examples in the 'stable' branches of each version
    # Note that this file was always incomplete  and lagging changes to configuration settings

    # for example, for 2.9: https://github.com/ansible/ansible/blob/stable-2.9/examples/ansible.cfg

    ### derouet     24 oct 2023    ajout [ssh_connection] ###

    [ssh_connection]
    ssh_args = -o ForwardAgent=yes -o ControlPersist=30m -o ServerAliveInterval=45 -o ServerAliveCountMax=10

    root@apaai001:/opt/freeware/etc/ansible #

    I understand i have to use COLLECTIONS_PATHS parameter.

    But when having a look to the details below i can see both "configured module search path" and "ansible collection location"

    root@apaai001:/opt/freeware/etc/ansible # ansible --version
    ansible [core 2.14.2]
      config file = /opt/freeware/etc/ansible/ansible.cfg
      configured module search path = ['/home/derouet/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
      ansible python module location = /opt/freeware/lib/python3.9/site-packages/ansible
      ansible collection location = /home/derouet/.ansible/collections:/usr/share/ansible/collections
      executable location = /opt/freeware/bin/ansible.orig
      python version = 3.9.17 (main, Jul  5 2023, 06:17:22) [GCC 10.3.0] (/opt/freeware/bin/python3.9)
      jinja version = 3.1.2
      libyaml = True
    root@apaai001:/opt/freeware/etc/ansible #

    So what is the best solution to update the ansible configuration file from "/home/derouet" to "/home/ansible/" ?

    I do not kwow if "/home/ansible" is the right place to store ansible-galaxy collections...  What could be a better choice ?

    I thank you very much for your help,

    Have a nice day,



    ------------------------------
    christophe derouet
    ------------------------------


  • 2.  RE: ansible-galaxy collection installation path / How to change it in the ansible.conf ?

    Posted Mon November 13, 2023 09:02 AM

    Hello,

    I would like to update the ansible configuration file.

    I would like to change "/home/derouet" to "/home/ansible/", how can i do this update please ?

    I thank you very much for your help,

    root@apaai001:/opt/freeware/etc/ansible # ansible --version
    ansible [core 2.14.2]
      config file = /opt/freeware/etc/ansible/ansible.cfg
      configured module search path = ['/home/derouet/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
      ansible python module location = /opt/freeware/lib/python3.9/site-packages/ansible
      ansible collection location = /home/derouet/.ansible/collections:/usr/share/ansible/collections
      executable location = /opt/freeware/bin/ansible.orig
      python version = 3.9.17 (main, Jul  5 2023, 06:17:22) [GCC 10.3.0] (/opt/freeware/bin/python3.9)
      jinja version = 3.1.2
      libyaml = True
    root@apaai001:/opt/freeware/etc/ansible #



    ------------------------------
    christophe derouet
    ------------------------------



  • 3.  RE: ansible-galaxy collection installation path / How to change it in the ansible.conf ?

    Posted Wed November 15, 2023 09:23 AM

    Hello,

    I am very happy because i was able to install the ibm.power_hmc collection.

    root@apaai001:/home/ansible #
    root@apaai001:/home/ansible # ansible-galaxy collection install /tmp/derouet/ibm-power_hmc-1.8.1.tar.gz -p /home/ansible/collection/
    Starting galaxy collection install process
    [WARNING]: The specified collections path '/home/ansible/collection' is not part of the configured Ansible collections paths
    '/home/derouet/.ansible/collections:/usr/share/ansible/collections'. The installed collection will not be picked up in an Ansible run, unless within a playbook-adjacent collections
    directory.
    Process install dependency map
    Starting collection install process
    Installing 'ibm.power_hmc:1.8.1' to '/home/ansible/collection/ansible_collections/ibm/power_hmc'
    ibm.power_hmc:1.8.1 was installed successfully
    root@apaai001:/home/ansible #

    But i understand i have to absolutely update the "configured Ansible collections" paths.

    Of course i will take time to find the solution in the documentation, but maybe you have an idea ?

    I thank you very much for your help,



    ------------------------------
    christophe derouet
    ------------------------------



  • 4.  RE: ansible-galaxy collection installation path / How to change it in the ansible.conf ?

    Posted Wed November 15, 2023 09:30 AM

    You can add a ansible.cfg file in your project with the following content to specify any path you want in your system. This makes it easy to use different collection versions in different projects.

    [defaults]
    collections_paths = /your/custom/path


    ------------------------------
    Niklas
    System Engineer UNIX and Linux on Power
    ------------------------------



  • 5.  RE: ansible-galaxy collection installation path / How to change it in the ansible.conf ?

    Posted Fri November 24, 2023 08:50 AM

    Hello Niklas,

    I thank you very much for your message.

    We had to reinstall the ansible_noarch rpm package as the installation path was not correct.

    We had to create a specific user for "ansible" and then reinstall the package ansible_noarch.

    That meams that now all the members of our teams will be able to work with Ansible.

    Before the re-installation of  Ansible  all the components where located in my personal home directory...

    Have a nice day,



    ------------------------------
    christophe derouet
    ------------------------------