Because the python docker container installs python to a location other
than /usr/bin, ansible doesn't know it have python3 available. Setting
this flag allows the build to use python3 and fix a pip error.
An extra setting ANSIBLE_STDOUT_CALLBACK=yaml is added to add clearer
output when running ansible, and can be overridden in the
docker-compose.yaml file.
Change-Id: I9dfc1aa0be17fb93d73e3ce321330558b44f7829
Signed-off-by: Trevor Bramwell <tbramwell@linuxfoundation.org>
FROM python:3
ENV CI_SYSTEM=jenkins
+ENV ANSIBLE_STDOUT_CALLBACK=yaml
+RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -yq \
+ python3-apt \
+ && apt-get clean
RUN pip install --no-cache-dir ansible docker-py
RUN mkdir /etc/ansible
WORKDIR /usr/src/ansible
-CMD ["ansible-playbook", "/usr/src/ansible/site.yaml", "-i", "/etc/ansible/inventory.ini"]
+CMD ["ansible-playbook", "-v", "/usr/src/ansible/site.yaml", "-i", "/etc/ansible/inventory.ini"]
-localhost ansible_connection=local
+localhost ansible_connection=local ansible_python_interpreter=/usr/local/bin/python3