Orchestrating tests as docker swarm using ansible

Let me explain the title

  1. I have 3 hosts all running as docker swarm, all CentOS-7. One master and two workers

  2. On the master I want to start a docker container (service?) by importing image from the company hosted repo (Done and works)

  3. This image contains ansible playbook and all the code sufficient to run it

  4. It starts with interactive script that collects info from user (some runtime parameters) and then runs the ansible playbook which is no longer interactive at that point

  5. The ansible playbook should obtain another image and deploy it as a docker service to both nodes. This service then runs test engine (JMeter if you wonder) that executes some JDBC calls to the external database (not in a container but accessible from network).

  6. How do I interact with the manager container if that is running as a service?

  7. How do I import a worker docker image and push it to the worker nodes (hopefully by using ansible) and then start these as a service? (no, I don’t need to interact with it). Can it be done since I’m trying to do it from within the manager container?

This question is also on Stackoverfolow, answer it there to claim a credit