Scenario
I run the following tasks in two terminals at the same time
- first one succeeds
- second one gives above error
So we are getting the above error while running the ansible-playbook for multiple sessions at the same time
Data could not be sent to remote host [internal ip]. Make sure this host can be reached over ssh
The piece of code being executed by task which fails is
- name: run docker container
docker_container:
name: "{{ container_name }}"
image: "organization/{{ app_name }}:{{ docker_image_version }}"
# command: "{{ adhoc_command }}"
command: "/bin/sh /data/run-command.sh"
state: started
recreate: yes
capabilities:
- sys_time
cap_drop:
- all
privileged: true
cleanup: true
detach: false
network_mode: host
env_file: "{{ adhock_data_path }}/{{ app_name }}/{{ md5suffix }}/.env"
volumes:
- "{{ adhock_data_path }}/{{ app_name }}/{{ md5suffix }}:/data:rw"
I suspect it is happening as we are trying to do some heavy tasks in the container at the same time.
I was thinking if there was some solution to delay the connection as well with something like the following
wait_for_connection:
delay: 30
timeout: 300
But we have the same issue when both the tasks are being executed simultaneously. Any help would be appreciated.
If required, I can provide additional information as well.