Specify Python in Ansible inventory template file 13/101813/11
authorJan Benedikt <j.benedikt@partner.samsung.com>
Mon, 17 Feb 2020 08:26:54 +0000 (09:26 +0100)
committerJan Benedikt <j.benedikt@partner.samsung.com>
Sat, 29 Feb 2020 23:00:07 +0000 (23:00 +0000)
Created copy of inventory template due to set var of Python interpreter.
Python interpreter cannot be set in ansible.cfg file due to bug:
https://github.com/ansible/ansible/issues/45852

Issue-ID: OOM-1671
Signed-off-by: Jan Benedikt <j.benedikt@partner.samsung.com>
Change-Id: I9683a2a764e8c6696a39625a6ddc40cda20f9333

ansible/ansible.cfg
tools/cicdansible/roles/install/tasks/install.yml
tools/cicdansible/roles/install/templates/inventory.yml.j2

index 0978b81..b92f885 100644 (file)
@@ -1,9 +1,9 @@
 [defaults]
-
 # Define any custom roles used by applications installed by installer
 # this parameter is telling ansible what additional folder it should
 # browse while looking up for roles code
 # relative path ./application is mapped into ansible container under
 # /ansible/application where application roles should be found
 roles_path = /ansible/application
+# Set log file
 log_path = /ansible/log/ansible.log
index 529e2ac..5c4bcd8 100644 (file)
@@ -14,7 +14,7 @@
   unarchive:
     src: "resources/{{ hostvars[groups['resources'][0]].resources_sw_filename }}"
     dest: "{{ installer_deploy_path }}"
-#Generate ansible inventory and extra vars.
+#Generate ansible inventory and extra vars
 - name: "Generate ansible inventory for installer"
   template:
     src: inventory.yml.j2
index faec590..9f7e08f 100644 (file)
@@ -1,5 +1,8 @@
 all:
   vars:
+{% if hostvars['infra'].ansible_distribution in ["Debian","Ubuntu"] %}
+    ansible_python_interpreter: "/usr/bin/python3"
+{% endif %}
     ansible_ssh_private_key_file: /root/.ssh/id_rsa
     ansible_ssh_common_args: "-o StrictHostKeyChecking=no"
   children: