I thought I had found something that would make managing the /etc/resolv.conf file easy. https://galaxy.ansible.com/ahuffman/resolv but when I try to install this role as per the documentation like so ...
bash-3.2$ ansible-galaxy install ahuffman.resolv
I get this error ...
Starting galaxy role install process
[WARNING]: - ahuffman.resolv was NOT installed successfully: Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': <urlopen error [SSL:
CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)>
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
I have never used ansible-galaxy before ... and probably won't ever again :(
Please help.
If I run with -vvvv I see this additional output:
ansible-galaxy 2.10.5
config file = None
configured module search path = ['/Users/red/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/ansible
executable location = /Library/Frameworks/Python.framework/Versions/3.6/bin/ansible-galaxy
python version = 3.6.8 (v3.6.8:3c6b436a57, Dec 24 2018, 02:04:31) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
No config file found; using defaults
Starting galaxy role install process
Processing role ahuffman.resolv
Initial connection to galaxy_server: https://galaxy.ansible.com
Opened /Users/red/.ansible/galaxy_token
Calling Galaxy at https://galaxy.ansible.com/api/
[WARNING]: - ahuffman.resolv was NOT installed successfully: Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/': <urlopen error [SSL:
CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)>
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
Running with --ignore-certs seems to have fixed the problem but the usage from anisble-galaxy does mention a --ignore-certs option:
usage: ansible-galaxy [-h] [--version] [-v] TYPE ...
Perform various Role and Collection related operations.
positional arguments:
TYPE
collection Manage an Ansible Galaxy collection.
role Manage an Ansible Galaxy role.
optional arguments:
--version show program's version number, config file location,
configured module search path, module location, executable
location and exit
-h, --help show this help message and exit
-v, --verbose verbose mode (-vvv for more, -vvvv to enable connection
debugging)
Related
First I install the Volttron recipes via
ansible-galaxy install git+https://github.com/volttron/volttron-ansible.git
Then Verify the install
ansible-galaxy list
# /Users/username/.ansible/roles
- volttron-ansible, (unknown version)
Then I setup the host and try to run the playbook
ansible-playbook -K \
-i $TEST_HOST \
playbooks/install-platform.yml
# TEST_HOST is the path the to host file
And I get the error:
ERROR! the role 'volttron.deployment.set_defaults' was not found in /Users/username/Development/iot/experiment-volttron/playbooks/roles:/Users/username/.ansible/roles/volttron-ansible:/Users/username/Development/iot/experiment-volttron/playbooks
The error appears to be in '/Users/username/Development/iot/experiment-volttron/playbooks/install-platform.yml': line 6, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
roles:
- volttron.deployment.set_defaults
^ here
The Host connects correctly - and the roles seemed to be installed at /Users/username/.ansible/roles/volttron-ansible correctly.
Any suggestions?
I am trying my hand on Ansible after having a very nice training in it. Currently, my task is to create a playbook that sets up a PostgreSQL cluster (with Patroni and etcd).
However, while installing PostgreSQL should be a pretty easy task, doing it using the zypper plugin throws an error. First, the part of the playbook that should install PostgreSQL:
- name: Installation PostgreSQL 14 Latest ohne Recommendations
become: true
zypper:
disable_recommends: true
name:
postgresql14-server
postgresql14-contrib
postgresql14-devel
update_cache: true
when: ansible_host in pgservers
The error message given is this:
fatal: [goeccdb22l]: FAILED! => {"changed": false, "cmd": ["/usr/bin/zypper", "--quiet", "--non-interactive", "--xmlout", "install", "--type", "package", "--auto-agree-with-licenses", "--no-recommends", "--", "+postgresql14-server postgresql14-contrib postgresql14-devel"], "msg": "No provider of '+postgresql14-server postgresql14-contrib postgresql14-devel' found.", "rc": 104, "stderr": "", "stderr_lines": [], "stdout": "<?xml version='1.0'?>\n<stream>\n<message type=\"error\">No provider of '+postgresql14-server postgresql14-contrib postgresql14-devel' found.</message>\n</stream>\n", "stdout_lines": ["<?xml version='1.0'?>", "<stream>", "<message type=\"error\">No provider of '+postgresql14-server postgresql14-contrib postgresql14-devel' found.</message>", "</stream>"]}
Let's extract the error message:
"msg": "No provider of '+postgresql14-server postgresql14-contrib postgresql14-devel' found."
I tried to replicate the problem using the shell on the target server. However, running the command seems to be able to install the packages:
ansible#goeccdb22l:~> sudo /usr/bin/zypper install --type package --auto-agree-with-licenses --no-recommends -- +postgresql14-server postgresql14-contrib postgresql14-devel
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 12 NEW packages are going to be installed:
libecpg6 libopenssl-1_1-devel libpq5 postgresql postgresql14 postgresql14-contrib postgresql14-devel postgresql14-server postgresql-contrib postgresql-devel postgresql-server zlib-devel
The following package needs additional customer contract to get support:
postgresql14
12 new packages to install.
Overall download size: 8.0 MiB. Already cached: 0 B. After the operation, additional 35.4 MiB will be used.
Continue? [y/n/v/...? shows all options] (y):
I've removed only the --quiet and --non-interactive options from the command, but kept all other given options.
The best idea I have is that the user/privilege escalation workings could be different from me logging in as the Ansible user to the target and just using sudo before the command.
Edit 1: I have developed an idea what the problem could be. As I mentioned above, when I tested the command, I removed two options: --quiet and --non-interactive. Testing the command with those two options gives the message:
The flag --quiet is not known.
However, using man zypper, I can clearly see that --quiet is a documented option:
-q, --quiet
Suppress normal output. Brief (esp. result notification) messages and error messages will still be printed, though. If used together with conflicting --verbose option, the --verbose option takes preference.
Now, my idea is that Ansible calls the command it documents in the return XML, but that because somehow --quiet is not understood it interprets that as nothing providing the requested package list. So that would leave two questions:
Why is --quiet not understood, yet documented? Is that a problem of SLES vs. OpenSuse?
How to work around that?
As the Ansible zypper module has no option to suppress the --quiet option I don't see any chance of working around it with parameters. The last option would be to split the zypper task into smaller shell tasks which I would like to avoid if possible.
So, with the help of a knowledgeable sysadmin I was able to diagnose the problem.
The list of packages documented above was not in fact a list. As I missed the dashes in front of the packages, Ansible accepted the packages with the newlines and everything as one package name and tried to install it.
The solution is to change the packages into a list of packages by prefixing them with dashes/minus signs.
The problem with --quiet was that it is a positional argument, and I used the wrong position when testing it.
I have a problem with the Ansible AWX instance on K3s.
Used guide: https://computingforgeeks.com/how-to-install-ansible-awx-on-ubuntu-linux/
I want to use the Ansible collections install option when syncing my project to git but that doesn't work.
I am using collections/requirements.yml file which during execution expects on a random collection (I want to install 7 collections from)
My collections:
community.general
community.mysql
community.docker
ansible.posix
community.vmware
community.zabbix
awx.awx
Error with job details (Standard Error):
ERROR! Failed to download collection tar from 'server0': <urlopen error [Errno -2] Name or service not known>
Error with manual installation in a container with -vvv and -c flags
bash-4.4$ ansible-galaxy collection install -r requirements.yml --collections-path /var/lib/awx/projects/.__awx_cache/_15__gitlab_ansible_awx_devops/stage/requirements_collections -vvv -c
ansible-galaxy [core 2.12.5.post0]
config file = None
configured module search path = ['/home/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
ansible collection location = /home/runner/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible-galaxy
python version = 3.8.12 (default, Sep 21 2021, 00:10:52) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
jinja version = 2.10.3
libyaml = True
No config file found; using defaults
Reading requirement file at '/var/lib/awx/projects/_15__gitlab_ansible_awx_devops/collections/requirements.yml'
Starting galaxy collection install process
Process install dependency map
Opened /home/runner/.ansible/galaxy_token
[WARNING]: Skipping Galaxy server https://galaxy.ansible.com/api/. Got an unexpected error when getting available versions of collection community.general: Unknown
error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/v2/collections/community/general/': <urlopen error [Errno 101] Network is unreachable>
ERROR! Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/v2/collections/community/general/': <urlopen error [Errno 101] Network is unreachable>
It alternates between getting the error with "Network is unreachable" and "Name or service not known". Local installation goes without any problem.
Thanks for any help
Info:
Ubuntu 20.04
ansible [core 2.12.5.post0]
AWX 21.1.0
k3s version v1.23.6+k3s1 (418c3fa8)
The repo and tag look good to me. I can install it without specifying the tag, but then it's not versioned:
Starting galaxy role install process
[WARNING]: - ansible-role-shell was NOT installed successfully: - command /usr/bin/git checkout v0.0.1 failed in directory
/home/spiderman/.ansible/tmp/ansible-local-96104higi5m4h/tmpzuylb5_v/ansible-role-shell (rc=1) - error: pathspec 'v0.0.1' did not match
any file(s) known to git
ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
spiderman#parallels-Parallels-Virtual-Platform:~$ ansible-galaxy install git+https://github.com/natemarks/ansible-role-shell.git
Starting galaxy role install process
- extracting ansible-role-shell to /home/spiderman/.ansible/roles/ansible-role-shell
- ansible-role-shell was installed successfully
spiderman#parallels-Parallels-Virtual-Platform:~$ ansible-galaxy list
# /home/spiderman/.ansible/roles
- ansible-role-shell, (unknown version)
[WARNING]: - the configured path /usr/share/ansible/roles does not exist.
[WARNING]: - the configured path /etc/ansible/roles does not exist.
Thanks in advance for any suggestions!
I thought I had pushed tags. Answer in comments correctly pointed out that I did not.
I've got a problem with installing ansible collection which is ending with timeout
# ansible-galaxy collection install community.general -vvvv
ansible-galaxy 2.9.9
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible-galaxy
python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Using /etc/ansible/ansible.cfg as config file
Process install dependency map
Initial connection to galaxy_server: https://galaxy.ansible.com
Created /root/.ansible/galaxy_token
Calling Galaxy at https://galaxy.ansible.com/api/
Processing requirement collection 'community.general'
Collection requirement 'community.general' is the name of a collection
Found API version 'v1, v2' with Galaxy server default (https://galaxy.ansible.com/api/)
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/community/general/versions/
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/community/general/versions/1.2.0/
Collection 'community.general' obtained from server default https://galaxy.ansible.com/api/
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/google/cloud/versions/
Processing requirement collection 'google.cloud' - as dependency of community.general
Collection requirement 'google.cloud' is the name of a collection
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/google/cloud/versions/?page=2
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/posix/versions/
Collection 'google.cloud' obtained from server default https://galaxy.ansible.com/api/
Processing requirement collection 'ansible.posix' - as dependency of community.general
Collection requirement 'ansible.posix' is the name of a collection
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/posix/versions/?page=2
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/posix/versions/?page=3
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/posix/versions/?page=4
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/posix/versions/?page=5
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/netcommon/versions/
Collection 'ansible.posix' obtained from server default https://galaxy.ansible.com/api/
Processing requirement collection 'ansible.netcommon' - as dependency of community.general
Collection requirement 'ansible.netcommon' is the name of a collection
Calling Galaxy at https://galaxy.ansible.com/api/v2/collections/ansible/netcommon/versions/?page=2
ERROR! Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/v2/collections/ansible/netcommon/versions/?page=2': The read operation timed out
$ time curl https://galaxy.ansible.com/api/
{"description":"GALAXY REST API","current_version":"v1","available_versions":{"v1":"v1/","v2":"v2/"},"server_version":"3.4.7","version_name":"Doin' it Right","team_members":["chouseknecht","cutwater","alikins","newswangerd","awcrosby","tima","gregdek"]}
real 0m0.502s
user 0m0.028s
sys 0m0.015s
Problem is quite obvious:
# time curl https://galaxy.ansible.com/api/v2/collections/ansible/netcommon/versions/?page=2
<---- PAYLOAD ---->
real 0m0.979s
user 0m0.037s
sys 0m0.018s
# time curl https://galaxy.ansible.com/api/v2/collections/ansible/netcommon/versions/?page=2
<---- PAYLOAD ---->
real 0m16.729s
user 0m0.029s
sys 0m0.014s
# ping galaxy.ansible.com
PING galaxy.ansible.com (104.26.0.250) 56(84) bytes of data.
.....
44 packets transmitted, 44 received, 0% packet loss, time 104ms
rtt min/avg/max/mdev = 2.815/5.372/30.278/5.817 ms
# ping 8.8.8.8
.....
24 packets transmitted, 24 received, 0% packet loss, time 59ms
rtt min/avg/max/mdev = 2.866/4.895/25.451/4.608 ms
So I decided to install collection from tarball and end-up in same problem but this time with downloading dependencies timeout
# ansible-galaxy collection install community-general-1.2.0.tar.gz -p /home/ansible/.ansible/collections -vvvv
.....
Process install dependency map
.....
Starting collection install process
Installing 'community.general:1.2.0' to '/home/ansible/.ansible/collections/ansible_collections/community/general'
Installing 'ansible.netcommon:1.3.0' to '/home/ansible/.ansible/collections/ansible_collections/ansible/netcommon'
Downloading https://galaxy.ansible.com/download/ansible-netcommon-1.3.0.tar.gz to /home/ansible/.ansible/tmp/ansible-local-1151707428cblg0/tmpbph_yq9r
ERROR! Unexpected Exception, this is probably a bug: The read operation timed out
OS is Centos8, Ansible config files are original from installation package...
$ cat /etc/os-release
NAME="CentOS Linux"
VERSION="8 (Core)"
PLATFORM_ID="platform:el8"
$ ansible --version
ansible 2.9.9
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/local/lib/python3.6/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)]
Any idea how to overcome this problem?
Thanks!
Maybe your network provider blocked the website https://galaxy.ansible.com/, try using a proxy server,e.g.
export http_proxy=http://proxy_server_ip:port;
export https_proxy=http://proxy_server_ip:port;