51 lines
1.1 KiB
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
2019-12-13 15:41:45 +03:00
privileged: "{{ docker_privileged }}"
mounts:
- type: bind
source: /sys/fs/cgroup
target: /sys/fs/cgroup
- type: bind
source: /sys/fs/fuse
target: /sys/fs/fuse
- type: tmpfs
target: /run
- type: tmpfs
target: /run/lock
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"