This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
ansible:ansible_collections [2025/03/14 10:10] manu |
ansible:ansible_collections [2025/03/19 11:13] (current) manu [Ansible collections] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Ansible collections ====== | ====== Ansible collections ====== | ||
+ | |||
+ | ===== Ansible collections ===== | ||
List or verify installed collections | List or verify installed collections | ||
Line 6: | Line 8: | ||
</cli> | </cli> | ||
+ | <cli prompt='$'> | ||
+ | [ansible@ansib100 download]$ ansible-galaxy collection list -vvvv | ||
+ | ansible-galaxy [core 2.11.4] | ||
+ | config file = /etc/ansible/ansible.cfg | ||
+ | configured module search path = ['/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] | ||
+ | ansible python module location = /usr/local/lib/python3.6/site-packages/ansible | ||
+ | ansible collection location = /ansible/.ansible/collections:/usr/share/ansible/collections | ||
+ | executable location = /usr/local/bin/ansible-galaxy | ||
+ | python version = 3.6.8 (default, Nov 15 2024, 08:18:48) [GCC 8.5.0 20210514 (Red Hat 8.5.0-22)] | ||
+ | jinja version = 2.10.1 | ||
+ | libyaml = True | ||
+ | Using /etc/ansible/ansible.cfg as config file | ||
+ | Searching /ansible/.ansible/collections/ansible_collections for collections | ||
+ | Found installed collection ibm.power_aix:1.5.1 at '/ansible/.ansible/collections/ansible_collections/ibm/power_aix' | ||
+ | Found installed collection ibm.power_linux_sap:1.0.10 at '/ansible/.ansible/collections/ansible_collections/ibm/power_linux_sap' | ||
+ | Found installed collection ibm.power_aix_oracle_dba:2.0.0 at '/ansible/.ansible/collections/ansible_collections/ibm/power_aix_oracle_dba' | ||
+ | Found installed collection community.general:6.4.0 at '/ansible/.ansible/collections/ansible_collections/community/general' | ||
+ | # /ansible/.ansible/collections/ansible_collections | ||
+ | Collection Version | ||
+ | ------------------------ ------- | ||
+ | community.general 6.4.0 | ||
+ | ibm.power_aix 1.5.1 | ||
+ | ibm.power_aix_oracle_dba 2.0.0 | ||
+ | ibm.power_linux_sap 1.0.10 | ||
+ | </cli> | ||
- | ====== Ansible modules ====== | + | Set proxy and upgrade a collection |
+ | <cli prompt='$'> | ||
+ | [ansible@ansib100 download]$ export https_proxy=http://proxy.test.lu:443 | ||
+ | [ansible@ansib100 download]$ ansible-galaxy collection install ibm.power_aix --upgrade | ||
+ | Starting galaxy collection install process | ||
+ | Process install dependency map | ||
+ | Starting collection install process | ||
+ | Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/ibm-power_aix-2.0.3.tar.gz to /ansible/.ansible/tmp/ansible-local-28837207f02n350/tmpnmabbk_r/ibm-power_aix-2.0.3-n8hzcqfk | ||
+ | Installing 'ibm.power_aix:2.0.3' to '/ansible/.ansible/collections/ansible_collections/ibm/power_aix' | ||
+ | ibm.power_aix:2.0.3 was installed successfully | ||
+ | </cli> | ||
- | List or verify installed modules — whether built-in or add-on | + | Manually install a collection from a tar file, to a specified directory |
<cli prompt='#'> | <cli prompt='#'> | ||
- | # ansible-doc --list | + | # ansible-galaxy collection install my_namespace-my_collection-1.0.0.tar.gz -p ./collections |
+ | </cli> | ||
+ | |||
+ | ===== Ansible plugin ===== | ||
+ | |||
+ | Plugins extend Ansible’s core functionality. | ||
+ | |||
+ | To list plugins, use the modules commands following... | ||
+ | |||
+ | |||
+ | ===== Ansible modules ===== | ||
+ | |||
+ | Modules are a type of plugin that execute automation tasks on a ‘target’ (usually a remote system). | ||
+ | |||
+ | List or verify installed modules — whether built-in or add-on | ||
+ | <cli prompt='$'> | ||
+ | [ansible@lnx100 ~]$ ansible-doc --list | ||
+ | a10_server Manage A10 Networks AX/SoftAX/Thunder/vThunder devices' server object | ||
+ | a10_server_axapi3 Manage A10 Networks AX/SoftAX/Thunder/vThunder devices | ||
+ | a10_service_group Manage A10 Networks AX/SoftAX/Thunder/vThunder devices' service groups | ||
+ | a10_virtual_server Manage A10 Networks AX/SoftAX/Thunder/vThunder devices' virtual servers | ||
+ | accelerate UNDOCUMENTED | ||
Or | Or | ||
- | # ansible-doc -t module -l | + | $ ansible-doc -t module -l |
</cli> | </cli> | ||
+ | More detailled | ||
+ | <cli prompt='$'> | ||
+ | [ansible@lnx100 ~]$ ansible-doc -F | ||
+ | a10_server /usr/local/lib/python3.6/site-packages/ansible/modules/network/a10/a10_server.py | ||
+ | a10_server_axapi3 /usr/local/lib/python3.6/site-packages/ansible/modules/network/a10/a10_server_axapi3.py | ||
+ | a10_service_group /usr/local/lib/python3.6/site-packages/ansible/modules/network/a10/a10_service_group.py | ||
+ | a10_virtual_server /usr/local/lib/python3.6/site-packages/ansible/modules/network/a10/a10_virtual_server.py | ||
+ | </cli> | ||
+ | |||
+ | Paths for modules: | ||
+ | <cli prompt='$'> | ||
+ | [ansible@lnx100 ~]$ ansible-config dump |grep DEFAULT_MODULE_PATH | ||
+ | DEFAULT_MODULE_PATH(default) = ['/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] | ||
+ | </cli> | ||
+ | |||
+ | To use a specific module, use | ||
+ | <code> | ||
+ | - name: unzip the zip folder | ||
+ | ansible.builtin.unarchive: | ||
+ | src: /var/www/html/techmax-main.zip | ||
+ | dest: /var/www/html | ||
+ | remote_src: yes | ||
+ | </code> | ||
+ | |||
+ | === Man page for each module is available using === | ||
+ | |||
+ | <cli prompt='$'> | ||
+ | [ansible@lnx100 ~]$ ansible-doc -t module ibm.power_aix.user | ||
+ | > IBM.POWER_AIX.USER (/ansible/.ansible/collections/ansible_collections/ibm/power_aix/plugins/modules/user.py) | ||
+ | |||
+ | This module facilitates the creation of a new user with provided attributes, the modification of attributes or deletion of an existing user. | ||
+ | |||
+ | OPTIONS (= is mandatory): | ||
+ | |||
+ | - attributes | ||
+ | Specifies the attributes to be changed or created for the user. | ||
+ | For details on valid user attributes, please refers to IBM documentation at https://www.ibm.com/support/knowledgecenter/ssw_aix_72/c_commands/chuser.html. | ||
+ | If you have the proper authority, you can set the following usual user attributes account_locked, admin, admgroups, capabilities, cpu, daemon, data, default_roles, | ||
+ | dictionlist, domains, expires, fsize, fsize_hard, gecos, groups, histexpire, home, id, login, loginretries, logintimes, maxages, maxexpired, maxrepeats, maxulogs, | ||
+ | minage, minalpha, mindiff, minlen, minother, nofiles, nproc, pgrp, projects, pwdchecks, pwdwarntime, rcmds, rlogin, roles, rss, shell, stack, su, sugroups, sysenv, | ||
+ | threads, tpath, ttys, umask, usrenv, etc. | ||
+ | [Default: (null)] | ||
+ | type: dict | ||
+ | ... | ||
+ | EXAMPLES: | ||
+ | |||
+ | - name: Create user aixguest1010 | ||
+ | ibm.power_aix.user: | ||
+ | state: present | ||
+ | name: aixguest1010 | ||
+ | change_passwd_on_login: False | ||
+ | password: as$12ndhkfjk$1c | ||
+ | attributes: | ||
+ | home: /home/test/aixguest1010 | ||
+ | data: 1272 | ||
+ | |||
+ | </cli> | ||
+ | |||
+ | ===== Sources collections ===== | ||
https://docs.ansible.com/ansible/latest/collections/index.html | https://docs.ansible.com/ansible/latest/collections/index.html | ||
Line 32: | Line 150: | ||
VMware vSphere Automation SDK for Python | VMware vSphere Automation SDK for Python | ||
https://github.com/vmware/vsphere-automation-sdk-python | https://github.com/vmware/vsphere-automation-sdk-python | ||
+ | | ||
+ | ==== Collections for IBM Power / AIX ==== | ||
+ | |||
+ | https://galaxy.ansible.com/ui/repo/published/ibm/power_aix/ | ||
+ | |||
+ | https://galaxy.ansible.com/ui/repo/published/ibm/power_vios/ | ||
+ | |||
+ | https://galaxy.ansible.com/ui/repo/published/ibm/power_hmc/ | ||
+ | |||
+ | https://www.ansible.com/blog/aix-patch-management-with-ansible | ||
+ | |||
+ | https://github.com/aixoss/ansible-playbooks | ||
+ | |||
+ | https://github.com/IBM/ansible-power-aix-oracle | ||
+ | |||
+ | https://github.com/IBM/ansible-power-hmc | ||
+ | |||
+ | https://github.com/lg4U (PowerVC) | ||
+ | |||
+ | ==== Collections for IBM Storage ==== | ||
+ | |||
+ | https://galaxy.ansible.com/ui/repo/published/ibm/storage_virtualize/ | ||
+ | |||
+ | ==== Collections for Broadcom/Brocade SAN switches ==== | ||
+ | |||
+ | https://galaxy.ansible.com/ui/repo/published/brocade/fos/ |