Benutzer-Werkzeuge

Webseiten-Werkzeuge


de:sysadmin:tools:ansible-mit-python3

Ansible mit Python3 (2020-01)

Im Januar 2020 wurde der Support für Python2 eingestellt. Manche Programme muss man allerdings momentan noch dazu zwingen, Python3 zu verwenden. (Vielleicht, weil bei meiner Distribution noch python2 Default ist?).

Ansible ist leider auch dabei …

Dieses kleine Shell-Script erzwingt auf dem Controll-Rechner das beim Aufruf python3 verwendet wird.

Bei sonderbaren Fehlern mit Modulen: Ich mußte ein paar Libraries für python3 nachinstallieren (pip3 install) und ein dann sogar eine .pyc Datei rauswerfen.

#!/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

Und dann noch ein paar passende Symlinks machen für ansible-playbook, ansible-pull und ansible-doc

de/sysadmin/tools/ansible-mit-python3.txt · Zuletzt geändert: 2020-01-30 15:05 von hella

Seiten-Werkzeuge

Mastodon Twitter