properly set ansible_python_interpreter for local task execution

this works a limitation in ansible for connection: local and makes it so
that you can run connection: local playbooks with a /usr/bin/python that
is Python3 and an Ansible virtualenv that is Python2

see: https://github.com/ansible/awx/issues/3267
This commit is contained in:
Ryan Petrello
2019-04-15 19:54:04 -04:00
parent 7f5227809f
commit 9d000a76de
2 changed files with 8 additions and 3 deletions

View File

@@ -47,7 +47,7 @@ class Command(BaseCommand):
created_by=superuser)
Host.objects.create(name='localhost',
inventory=i,
variables="ansible_connection: local",
variables="ansible_connection: local\nansible_python_interpreter: '{{ ansible_playbook_python }}'",
created_by=superuser)
jt = JobTemplate.objects.create(name='Demo Job Template',
playbook='hello_world.yml',