Benutzer-Werkzeuge

Webseiten-Werkzeuge


en:sysadmin:tools:ansible-with-python3

Ansible with Python3 (2020-01)

January 2020 Support for python2 was stopped. But some tools you still have to force to use python3 (maybe, because the python2 ist still the default on my distribution?)

Ansible is one of these cases …

This small shell script forces ansible to use python3 on the control computer.

If you have strange effects with modules: I had to install some libraries for python3 (pip3 install) and had to delete a certain .pyc file in that module.

#!/usr/bin/bash
# use ansible with python3
 
dir="/usr/local/packages/ansible/bin"
me=$(basename "$0")
 
case $me in
  ansible)
    python3 $dir/$me "$@"
  ;;
  ansible-playbook)
    python3 $dir/$me "$@"
  ;;
  ansible-pull)
    python3 $dir/$me "$@"
  ;;
  ansible-doc)
    python3 $dir/$me "$@"
  ;;
  *)
  # do nothing
  ;;
esac

Don't forget the matching symlinks for ansible-playbook, ansible-pull and ansible-doc ….

en/sysadmin/tools/ansible-with-python3.txt · Zuletzt geändert: 2020-01-30 15:06 von hella

Seiten-Werkzeuge

Mastodon Twitter