40 lines
792 B
YAML
Raw Normal View History

2016-04-17 19:43:00 +06:00
# test.yml
---
- hosts: localhost
become: no
gather_facts: no
tasks:
- name: Run MongoDB cluster in Docker
2018-02-15 13:14:31 +07:00
docker_container:
2016-04-17 19:43:00 +06:00
name: "{{ item }}"
image: "{{ image_name }}"
command: "/sbin/init"
state: started
privileged: true
2016-04-17 19:43:00 +06:00
with_items:
- mongo1
- mongo2
- mongo3
2018-03-02 12:41:17 +07:00
- hosts: mongo
become: no
gather_facts: no
tasks:
- name: gather tasks from all hosts
setup:
- hosts: "{{ target | default('mongo') }}"
2016-04-17 19:43:00 +06:00
become: no
gather_facts: yes
roles:
- role: greendayonfire.mongodb
2016-04-17 23:18:31 +06:00
when: "'mongo_master' in group_names"
2018-03-02 12:41:17 +07:00
- hosts: "{{ target | default('mongo') }}"
2016-04-17 23:18:31 +06:00
become: no
gather_facts: yes
roles:
- role: greendayonfire.mongodb
when: "'mongo_replicas' in group_names"