From 8ff7614a7c434826c9a67e49b0e20610b37ca89c Mon Sep 17 00:00:00 2001 From: jdubois Date: Mon, 30 Aug 2021 16:33:18 +0200 Subject: [PATCH] =?UTF-8?q?Modification=20pr=C3=A9-requis=20OpenBSD=20pour?= =?UTF-8?q?=20g=C3=A9rer=20toutes=20versions=20de=20python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HowtoAnsible.md | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/HowtoAnsible.md b/HowtoAnsible.md index 10190635..e213c628 100644 --- a/HowtoAnsible.md +++ b/HowtoAnsible.md @@ -1189,20 +1189,27 @@ Il est possible aussi d'accéder aux variables d'environnement shell : Voici les étapes nécessaires à l'utilisation d'Ansible sur des serveurs OpenBSD. -Installer _Python_ : +Installer _Python_ et _sudo_ : ~~~ -# pkg_add -z python-3 sudo +# pkg_add -z python sudo ~~~ -et surcharger la variable `ansible_python_interpreter` dans le fichier _inventory_ : +Faire un lien symbolique de "python" vers le python le plus récent sur la machine, pour palier le problème d'hétérogénéité de versions sur plusieurs machines OpenBSD différentes : + +~~~ +# ls -l /usr/local/bin/python* +# ln -s /usr/local/bin/pythonX.X /usr/local/bin/python +~~~ + +Et surcharger la variable `ansible_python_interpreter` dans le fichier _inventory_ : ~~~ [openbsd] serveur.example.com [openbsd:vars] -ansible_python_interpreter=/usr/local/bin/python3.9 +ansible_python_interpreter=/usr/local/bin/python ~~~ ### Ansible Vault via GPG @@ -1277,7 +1284,7 @@ Un cas concret : when: ansible_distribution_version | version_compare("5.6",'<') ~~~ -### Erreur : /usr/local/bin/python3.9: not found +### Erreur : /usr/local/bin/python: not found Si vous obtenez une erreur du type : @@ -1286,14 +1293,14 @@ $ ansible -m ping foo foo | FAILED! => { "changed": false, "failed": true, - "module_stderr": "/bin/sh: 1: /usr/local/bin/python3.9: not found\n", + "module_stderr": "/bin/sh: 1: /usr/local/bin/python: not found\n", "module_stdout": "", "msg": "MODULE FAILURE" } ~~~ Pour une raison inconnue, Ansible détecte mal le chemin vers Python. -Vous pouvez le forcer en utilisant l'option `-e 'ansible_python_interpreter=/usr/bin/python3.9'`. +Vous pouvez le forcer en utilisant l'option `-e 'ansible_python_interpreter=/usr/bin/python'`. ### Export HTML d'un playbook