Let's see my use case
- name: Run Nginx container
docker:
name: nginx
image: nginx
state: started
ports:
- "80:80"
- "443:443"
- name: Add host nginx container
add_host:
name: nginx
groups: nginx_container
ansible_connection: docker
ansible_user: root
ansible_docker_extra_args: --tlsverify --tlscacert="{{
nginx_container_docker_cert_path }}/ca.pem" --tlscert="{{
nginx_container_docker_cert_path }}/cert.pem" --tlskey="{{
nginx_container_docker_cert_path }}/key.pem" -H="{{
nginx_container_docker_host }}"
- name: Create new directory in nginx container
file:
path: /root/.ssh
state: directory
delegate_to: nginx
I have 2 hosts in inventory file to run nginx container on both hosts. Then
I want to add_host for both containers to do next task that will do on both
containers on both hosts.
I knew that add_host is bypass host loop but anyone know the way that I can
configure container with the same name on difference host?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/3b8163ea-1aee-47c7-a335-5ef78f0a945c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.