edulargo
(edulargo)
April 10, 2024, 12:51pm
1
Hi guys!
When i execute a pipeline on my jenkins to run an ansible-playbook command and an inventory yml file with this ansible plugin google.cloud.gcp_compute i recived this error:
[WARNING]: Failed to load inventory plugin, skipping google.cloud.gcp_compute
But if i execute same ansible-playbook command in CLI output is OK.
My config:
ansible-playbook [core 2.15.3]
config file = /etc/ansible/ansible.cfg configured module search path = [‘/var/lib/jenkins/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’] ansible python module location = /usr/lib/python3.11/site-packages/ansible ansible collection location = /home/ansible/.ansible/collections/ansible_collections/, /var/lib/jenkins/.ansible/collections executable location = /usr/bin/ansible-playbook python version = 3.11.5 (main, Sep 22 2023, 15:34:29) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/usr/bin/python3.11) jinja version = 3.1.2 libyaml = True
Thanks in advance!
Regards!
system
(system)
April 10, 2024, 1:54pm
2
try running `ansible-doc -t inventory -l` both ways, I suspect jenkins
is not setup to see the installed collection.
edulargo
(edulargo)
April 10, 2024, 3:03pm
3
Hi,
here output of the command, sustituted by my ansible-palybook command, that you said:
…
ansible-doc -t inventory -l ansible.builtin.advanced_host_list Parses a ‘host list’ with ranges ansible.builtin.auto Loads and executes an inventory plugin s… ansible.builtin.constructed Uses Jinja2 to construct vars and groups… ansible.builtin.generator Uses Jinja2 to construct hosts and group… ansible.builtin.host_list Parses a ‘host list’ string ansible.builtin.ini Uses an Ansible INI file as inventory so… ansible.builtin.script Executes an inventory script that return… ansible.builtin.toml Uses a specific TOML file as an inventor… ansible.builtin.yaml Uses a specific YAML file as an inventor… [Pipeline] } [Pipeline] // script [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // ansiColor [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS
Thanks!!
Regards,
system
(system)
April 10, 2024, 3:21pm
4
if that is the full output, we seem to be missing the google inventory
plugin, so clearly jenkins cannot see it, make sure it is installed in
one of the configured paths for the Jenkin's Ansible. You can also use
ansible-galaxy to list/install the collections to ensure it is
present.
edulargo
(edulargo)
April 10, 2024, 3:55pm
5
Brian,
The collections were installed.
On CLI with ansible user execution is correct but with jenkins pipeline not.
ansible collection location = /home/ansible/.ansible/collections/ansible_collections/, /var/lib/jenkins/.ansible/collections
executable location = /usr/bin/ansible-playbook
I had installed now Ansible plugin on Jenkin and set path where executables ansible are located and i see same situation.
name: ansible-playbook
path instalation: /usr/bin
thanks!
edulargo
(edulargo)
April 10, 2024, 4:06pm
6
Hi,
More info.
With ansible user exist the plugin:
[ansible@server01 ansible]$ ansible-doc -t inventory -l
[DEPRECATION WARNING]: t_systems_mms.icinga_director.icinga_director_inventory has been deprecated. Use telekom_mms.icinga_director.icinga_director_inventory instead. This feature will be removed from
t_systems_mms.icinga_director in version 3.0.0. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
amazon.aws.aws_ec2 EC2 inventory source
amazon.aws.aws_rds RDS instance inventory source
ansible.builtin.advanced_host_list Parses a ‘host list’ with ranges
ansible.builtin.auto Loads and executes an inventory plugin specified in a YAML config
ansible.builtin.constructed Uses Jinja2 to construct vars and groups based on existing inventory
ansible.builtin.generator Uses Jinja2 to construct hosts and groups from patterns
ansible.builtin.host_list Parses a ‘host list’ string
ansible.builtin.ini Uses an Ansible INI file as inventory source
ansible.builtin.script Executes an inventory script that returns JSON
ansible.builtin.toml Uses a specific TOML file as an inventory source
ansible.builtin.yaml Uses a specific YAML file as an inventory source
awx.awx.controller Ansible dynamic inventory plugin for the Automation Platform Controller
azure.azcollection.azure_rm Azure Resource Manager inventory plugin
cloudscale_ch.cloud.inventory cloudscale.ch inventory source
community.aws.aws_mq MQ broker inventory source
community.digitalocean.digitalocean DigitalOcean Inventory Plugin
community.dns.hetzner_dns_records Create inventory from Hetzner DNS records
community.dns.hosttech_dns_records Create inventory from Hosttech DNS records
community.docker.docker_containers Ansible dynamic inventory plugin for Docker containers
community.docker.docker_machine Docker Machine inventory source
community.docker.docker_swarm Ansible dynamic inventory plugin for Docker swarm nodes
community.general.cobbler Cobbler inventory source
community.general.gitlab_runners Ansible dynamic inventory plugin for GitLab runners
community.general.icinga2 Icinga2 inventory source
community.general.linode Ansible dynamic inventory plugin for Linode
community.general.lxd Returns Ansible inventory from lxd host
community.general.nmap Uses nmap to find hosts to target
community.general.online Scaleway (previously Online SAS or Online.net ) inventory source
community.general.opennebula OpenNebula inventory source
community.general.proxmox Proxmox inventory source
community.general.scaleway Scaleway inventory source
community.general.stackpath_compute StackPath Edge Computing inventory source
community.general.virtualbox virtualbox inventory source
community.general.xen_orchestra Xen Orchestra inventory source
community.hrobot.robot Hetzner Robot inventory source
community.libvirt.libvirt Libvirt inventory source
community.okd.openshift OpenShift inventory source
community.vmware.vmware_host_inventory VMware ESXi hostsystem inventory source
community.vmware.vmware_vm_inventory VMware Guest inventory source
community.zabbix.zabbix_inventory Zabbix Inventory Plugin
dellemc.openmanage.ome_inventory Group inventory plugin on OpenManage Enterprise
google.cloud.gcp_compute Google Cloud Compute Engine inventory source <-----------------------
hetzner.hcloud.hcloud Ansible dynamic inventory plugin for the Hetzner Cloud
infoblox.nios_modules.nios_inventory Infoblox inventory plugin
kubernetes.core.k8s Kubernetes (K8s) inventory source
microsoft.ad.ldap Inventory plugin for Active Directory
netbox.netbox.nb_inventory NetBox inventory source
ngine_io.cloudstack.instance Apache CloudStack instance inventory source
openstack.cloud.openstack OpenStack inventory source
ovirt.ovirt.ovirt oVirt inventory source
t_systems_mms.icinga_director.icinga_director_inventory Returns Ansible inventory from Icinga
telekom_mms.icinga_director.icinga_director_inventory Returns Ansible inventory from Icinga
theforeman.foreman.foreman Foreman inventory source
vultr.cloud.vultr Retrieves list of instances via Vultr v2 API
Well, how Can i install same plugin for Jenkins can use it?
Thanks!
Regards
system
(system)
April 10, 2024, 4:48pm
7
I don't know, that is a 'jenkins plugin' question, i can only assert
that the way they execute Ansible is not picking up the collections
you installed, probably due to some configuration it injects.
edulargo
(edulargo)
April 11, 2024, 9:30am
8
Ok! I am reviewing this out of this
Thanks for ur support Brian!!
Regards,
–
Ed. < allways learning
edulargo
(edulargo)
April 11, 2024, 1:44pm
9
hi,
i found user that use to run jenkins pipeline and i had installed all plugins as ansible user on it.
Now run ok
Thanks for all.
Regards