简体   繁体   中英

ansible-container database init scripts

Trying to use ansible-container (0.2.0) to create a DB (postgres) container and initialize a database from a pg_dump file . Does ansible-containe r respect the /docker-entrypoint-initdb.d/ ? I tried few variations with no luck so wondering if this is officially supported.

Entrypoints are easy with ansible-container, but it's easier still if you are using roles.

In the service definition in container.yml put your entrypoint and command lines:

entrypoint: [/entrypoint.sh]
command: [/usr/bin/dumb-init, /opt/orson/mongo/bin/mongod --config /opt/orson/mongo/conf/mongod.conf]

Put a template of you entrypoint script in the templates folder of your role. Bring the script into your service in the main.yml of your role.

- name: Template entrypoint script
  template: src="entrypoint.sh.j2" dest="/entrypoint.sh" mode=0777

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM