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