ansible / ansible-container

DEPRECATED -- Ansible Container was a tool to build Docker images and orchestrate containers using only Ansible playbooks.
GNU Lesser General Public License v3.0
2.19k stars 392 forks source link

How to run multiple "commands" after container is started #915

Open binithlighting opened 6 years ago

binithlighting commented 6 years ago
ISSUE TYPE
container.yml
settings:
  conductor_base: ubuntu:16.04

services:

  hse25.0_rc1_85_2105:
    roles:
     - hse25.0_rc1_85_2105
    ports:
     - "8025:80"
     - "2105:2100/udp"
     - "44325:443"
     - "8425:8843"
    command: ["/bin/sh", "-c", "/root/hse/hse.sh -test" , "-test", "mystate"]
    command: ["/bin/sh", "-c", "echo" , "hellow"]
OS / ENVIRONMENT

Ansible Container, version 0.9.2 Linux, dockerbox-1, 4.13.0-32-generic, #35~16.04.1-Ubuntu SMP Thu Jan 25 10:13:43 UTC 2018, x86_64 2.7.12 (default, Nov 20 2017, 18:23:56)


##### SUMMARY
I am not able to figureout how to run an additional command after the container has started.
I think the way described in the container.yml(pasted above) is wrong, as it contains two "command" directives.

To be specific, I am looking for something like a "post-container-start" directive, or a way to run multiple commands. Ofcourse an option is to put all the required commands in a single shell script, but just wondering if there is another way.

##### STEPS TO REPRODUCE
Add a seconds command directive in container.yml

##### EXPECTED RESULTS
Run two (or more) commands, one after the other

##### ACTUAL RESULTS

Container wont start
re-mscho commented 6 years ago

Untested but I guess it works here too: https://github.com/docker-library/redmine/issues/52#issuecomment-269431168

Voronenko commented 6 years ago

@binithlighting Did you try advise by @re-mscho ?