ansible-minio/molecule/default/create.yml

38 lines
1.3 KiB
YAML
Raw Normal View History

---
- name: Create
hosts: localhost
connection: local
gather_facts: false
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
tasks:
- name: Create molecule instance(s)
docker_container:
name: "{{ item.name }}"
docker_host: "{{ item.docker_host | default('unix://var/run/docker.sock') }}"
hostname: "{{ item.name }}"
image: "{{ item.image }}"
state: started
recreate: false
log_driver: json-file
command: "{{ item.command | default(omit) }}"
privileged: "{{ item.privileged | default(omit) }}"
volumes: "{{ item.volumes | default(omit) }}"
capabilities: "{{ item.capabilities | default(omit) }}"
exposed_ports: "{{ item.exposed_ports | default(omit) }}"
published_ports: "{{ item.published_ports | default(omit) }}"
ulimits: "{{ item.ulimits | default(omit) }}"
networks: "{{ item.networks | default(omit) }}"
dns_servers: "{{ item.dns_servers | default(omit) }}"
register: server
with_items: "{{ molecule_yml.platforms }}"
async: 7200
poll: 0
- name: Wait for instance(s) creation to complete
async_status:
jid: "{{ item.ansible_job_id }}"
register: docker_jobs
until: docker_jobs.finished
retries: 300
with_items: "{{ server.results }}"