Why is ansible-core 2.12 not running Ansible core 2.12? - ansible

I've been updating an Ansible project, and as part of that I tried to update an assertion about the Ansible version:
- name: Check Ansible version
assert:
that:
- ansible_version.major == 2 and ansible_version.minor >= 5
I figured the version corresponded to the version of the ansible-core package installed, but that doesn't seem to be the case: it's installing ansible-core 2.12.3 and ansible 5.5.0, but changing the assertion to ansible_version.major == 2 and ansible_version.minor >= 12 results in a failure. If ansible_version corresponds to neither version, what does it correspond to?

The project is still using Python 3.6 (don't worry, upgrading it is on the way), which is no longer supported:
[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the controller starting with Ansible 2.12. Current version: 3.6.9 (default, Dec 8 2021, 21:08:43) [GCC 8.4.0]. This feature will be removed from ansible-core in version 2.12.
I was wondering why that was an error rather than a warning, considering I'm actually running Ansible (core) 2.12. But the very next line indicates that core 2.12 is capable of running with an older core:
ansible-playbook [core 2.11.9]

Related

Ansible install collection offline

I'm trying to install
Ansible from a tar file, but I seem to face issue regarding that:
ansible-galaxy collection install azure-azcollection-1.10.0.tar.gz
Ansible version is 2.10
00:03:08.902 [0mansible-galaxy 2.10.15
00:03:08.902 config file = None
00:03:08.902 configured module search path = ['/plugins/modules', '/ansible/library']
00:03:08.902 ansible python module location = /usr/local/lib/python3.6/site-packages/ansible
00:03:08.902 executable location = /usr/local/bin/ansible-galaxy
00:03:08.902 python version = 3.6.8 (default, Aug 13 2020, 07:46:32) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
Error I'm getting is:
0:03:25.896 [91m[0;31mERROR! Invalid collection name 'azure-azcollection-1.10.0.tar.gz', name must be in the format <namespace>.<collection>.
I followed this guide : https://www.redhat.com/sysadmin/install-ansible-disconnected-node
Any suggestions?
This is the error you will receive if you specify a file that does not exist.
ec2-user#honest-nyoijizai ~ $ ansible-galaxy --version
ansible-galaxy 2.10.15
config file = None
configured module search path = ['/home/ec2-user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/ec2-user/.local/lib/python3.7/site-packages/ansible
executable location = /home/ec2-user/.local/bin/ansible-galaxy
python version = 3.7.10 (default, Jun 3 2021, 00:02:01) [GCC 7.3.1 20180712 (Red Hat 7.3.1-13)]
ec2-user#honest-nyoijizai ~ $ ansible-galaxy collection install azure-azcollection-1.10.1.tar.gz
Starting galaxy collection install process
Process install dependency map
ERROR! Invalid collection name 'azure-azcollection-1.10.1.tar.gz', name must be in the format <namespace>.<collection>.
Please make sure namespace and collection name contains characters from [a-zA-Z0-9_] only.
ec2-user#honest-nyoijizai ~ $ ansible-galaxy collection install azure-azcollection-1.10.0.tar.gz
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Installing 'azure.azcollection:1.10.0' to '/home/ec2-user/.ansible/collections/ansible_collections/azure/azcollection'
azure.azcollection (1.10.0) was installed successfully

how do I update xarray?

How can I update xarray? I tried:
>>> import xarray
>>> xarray.show_versions
<function show_versions at 0x7fcfaf2aa820>
But I cannot find any documentation how to read this, or how to update to a new version of xarray.
I was not the person to install it on the computer, so I do not know if it was through anaconda or something else. Is there a way to find this out?
xarray.show_versions is a function, which prints the versions of xarray and its dependencies.
To get just the version of xarray, you can check the __version__ property of the module.
Updating xarray is best done with pip or conda, depending on how you installed it in the first place.
import xarray as xr
print(xr.__version__)
# '0.18.2'
xr.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.8.8 (default, Feb 19 2021, 18:07:06)
[GCC 8.3.0]
python-bits: 64
OS: Linux
OS-release: 5.11.0-27-generic
machine: x86_64
processor:
byteorder: little
LC_ALL: C.UTF-8
LANG: C.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.0
libnetcdf: 4.7.4
xarray: 0.18.2
pandas: 1.2.4
numpy: 1.20.3
scipy: 1.6.3
netCDF4: 1.5.6
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.8.3
cftime: 1.5.0
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.2.3
cfgrib: None
iris: None
bottleneck: 1.3.2
dask: 2021.05.0
distributed: 2021.05.0
matplotlib: 3.4.2
cartopy: None
seaborn: None
numbagg: None
pint: None
setuptools: 53.0.0
pip: 21.1.1
conda: None
pytest: None
IPython: 7.23.1
sphinx: None
To update xarray:
pip install --upgrade xarray
or
conda update xarray
To see if it was installed using conda or pip, run conda list xarray. If it was installed using pip, it should state pypi in the Channel column.
This is for those who want to do through GUI and who use software like pycharm, spyder, or other similar softwares.
SO, try finding 'python interpreter' in the settings. Most softwares shows the existing packages, current version,latest version(for example see the image of pycharm)
There is option to select the version that you want. for example there are times, when a module is in its beta phase and is not stable in usage. so, you can specify the latest stable version too. It is applicable for any module and not limited to xarray.

Can't run Ansible Playbook on M1 Mac

When I run ansible-playbook command I get the following error:
ERROR! unexpected parameter type in action: <class 'bool'>
The error appears to be in '/Users/mycomputer/.ansible/roles/wtanaka.jq/tasks/compat_sudo.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
---
- name: install python-apt on ansible < 1.6.0 and ubuntu et al
^ here
I took a look at that playbook, and I'm not seeing anything that sticks out at me:
---
- name: install python-apt on ansible < 1.6.0 and ubuntu et al
sudo: yes
Ansible Version:
ansible 2.10.7
config file = /Users/mycomputer/Tools/xeno-ansible/ansible.cfg
configured module search path = ['/Users/mycomputer/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /opt/homebrew/Cellar/ansible/3.1.0/libexec/lib/python3.9/site-packages/ansible
executable location = /opt/homebrew/bin/ansible
python version = 3.9.2 (default, Mar 26 2021, 15:28:17) [Clang 12.0.0 (clang-1200.0.32.29)]
Would this be an issue with Ansible and my M1 Mac or is there something in the playbook that is wrong?
In my case, the issue was that I was using an old playbook that isn't compatible with Ansible 2.9+. I had to install ansible using Rosetta2, similar to this.

ERROR! Unexpected Exception, this is probably a bug: 'AnsibleLoader' object has no attribute 'get_single_data'

When I repeat the command "ansible-playbook single.yml" to set the environment.
I got an ansible error "ERROR! Unexpected Exception, this is probably a bug: 'AnsibleLoader' object has no attribute 'get_single_data' to see the full traceback, use -vvv".
[root#localhost data]# ansible --version
ansible 2.8.4
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
I am not familiar with ansible, and I don't know why it worked before, but now I get an error, and I don't know how to solve it. It is my first time to ask questions here. Thank you for your reply.

Running Ansible not from source

I built an RPM for RH5 and I'm running into issues with some of the modules I need. First things first, I'm running Ansible 1.9.2. Now, once the RPM is installed, running ansible --version returns the following.
> ansible --version
ansible 1.9.2
configured module search path = None
One of the modules I need is Hipchat, which is throwing an SSL error.
PROTOCOL = ssl.PROTOCOL_TLSv1
NameError: name 'ssl' is not defined
Now, if I set PYTHONPATH to ~/ansible/lib everything works fine. ~ansible is a 1.9 copy from source. My RPM installs the Ansible libraries into /usr/lib/python2.6/site-packages/ansible. So if I point PYTHONPATH to that path, my module doesn't work and it doesn't show what I normally see below.
ansible 1.9.2 (stable-1.9 b70caac618) last updated 2015/06/05 15:22:40 (GMT-400)
lib/ansible/modules/core: (detached HEAD 618806aeeb) last updated 2015/03/04 12:39:45 (GMT -400)
lib/ansible/modules/extras: (detached HEAD 945da71ce4) last updated 2015/03/04 12:39:53 (GMT -400)
v2/ansible/modules/core: (detached HEAD 34784b7a61) last updated 2015/03/04 12:40:03 (GMT -400)
v2/ansible/modules/extras: (detached HEAD 650d740a3a) last updated 2015/03/04 12:40:10 (GMT -400)
configured module search path = None
Python 2.6 does not have built-in SSL support. You need to install PyOpenSSL from your distribution packages.
Adding SSL support to Python 2.6
https://pyopenssl.readthedocs.org/en/stable/

Resources