Hi AWX community!
I’m having the same issue as described here: https://github.com/ansible/awx/issues/593
But I think there is a confusion on the resolution and the issue is not related to docker_container.
As far as I understood Ansible internals:
- hosts: server
tasks:
- name: Mysql docker container UP
docker_container:
name: db
image: mysql:latest
state: started
restart_policy: always
env:
MYSQL_ROOT_PASSWORD:
Here, we are creating a mysql docker container on the "server" node.
Then, we add this newly created container (which name => db) to the inventory using add_host:
- name: add Mysql container to inventory
add_host:
name: db
ansible_connection: docker
ansible_user: root
ansible_docker_extra_args: "-H=tcp://remotehost:2375"
changed_when: False
And then we tell Ansible to connect to that specific container we just added into the inventory:
- name: install DB
delegate_to: db
gather_facts: False
mysql_db:
name: test
state: present
So, above the above module "mysql_db" will be run directly inside the container to provision it, Ok.
But the issue here, while doing that, is that it is not using the docker from the server node (hosts: server) but it seems to be using
the docker from the Ansible executor (hence here awx_task container), probably expanding the command like this: docker exec -ti -H=tcp://remotehost:2375 <ansible_invocation>
And hence, failing with the error message as described in the subject because docker command is not available in the awx_task container.
Is there any way to circumvent this? Also I don't really want to build a custom AWX docker image, I would rather if possible stick to the official images.
Thank you very much!
Regards,