setup
client
installed with
ansible 2.3.1.0
python version = 2.7.12 (v2.7.12:d33e0cf91556, Jun 26 2016, 12:10:39) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
host: RHEL 7
installed with
docker version 17.05.0-ce, build 89658be
docker-compose version 1.13.0, build 1719ceb
base image: ansible/centos7-ansible
Basic setup
A first ansible script
-
sets up the host server with docker, docker-compose, etc …
-
syncs the files necessary to create 2 containers: Apache tomEE and Mongo
-
Dockerfile, playbook.yml, vars.yml + any additional artefacts needed
The base container is ansible/centos7-ansible and NOT mongo or tomee because I want to set up specific installs.
Each images gets a specific playbook which is run during the build process
The last section of the master ansible script is this
`
- name: build and start both containers in compose style
docker_service:
state: “present”
project_src: “{{ host_home }}”
project_name: “orson”
restarted: “yes”
`
This section effectively builds the images and set them running on the same virtual network. And all of this works.
I just need to do one last thing. Part of the specific install is to create an application user and have all processes run under that user.
In native docker I can run
`
docker run -u username --name container_name -d image_name
`
But I don’t see any equivalent of the -u option in the docker_service module.
Did I miss it? Or is there a way to pass it through another way.
Thanks for any help