Hello,

I'm trying to figure out how to best stay declarative while being able to 
have my system properly reconfigure itself in the following situation:

- I have a bunch of docker hosts
- I have a bunch of docker containers. Each docker container hosts a 
service for a customer and is reachable from a specific subdomain of my 
company.
- I have a frontal nginx container doing virtual hosting to redirect 
traffic for a specific container to its current host+port.

So I have docker-hosts, and containers virtual hosts.

I'd like to write the configuration so that I have entries for the virtual 
hosts, with a parameter specifying on which docker host they must be set.

Now, if I move a docker container from docker host A to docker host B in 
the configuration, when I run the playbook I must ensure that the following 
is done:

- if the docker container is currently running on host B (in the example it 
is running on host A), then stop the container on host A
(to keep things simple, currently the containers data are in a centrally 
accessible place - from docker hosts - but I must ensure only one container 
at a time accesses the data - thus killing from A before starting from B).
- start the container from B
( - Reconfigure nginx and restart if necessary -> not a problem atm)

Do you have advices on how best to do this?

My current idea involves:
- creating entries in the inventory for each docker container virtualhost
- for each virtualhost, finding through docker hosts facts analysis where 
it is running (if at all), and then removing it if running in another host 
than what the config currently states

Does that make sense? Will it be easy to do? (still newbie here, so maybe 
not having the right grasp of what's easy or not with ansible)

Thanks in advance,

-- 
Laurent

-- 
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/abe41851-bcad-4dea-8211-1f9e40e9304d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to