ansible-role-mongodb/tests/site.yml

40 lines
792 B
YAML

# test.yml
---
- hosts: localhost
become: no
gather_facts: no
tasks:
- name: Run MongoDB cluster in Docker
docker_container:
name: "{{ item }}"
image: "{{ image_name }}"
command: "/sbin/init"
state: started
privileged: true
with_items:
- mongo1
- mongo2
- mongo3
- hosts: mongo
become: no
gather_facts: no
tasks:
- name: gather tasks from all hosts
setup:
- hosts: "{{ target | default('mongo') }}"
become: no
gather_facts: yes
roles:
- role: greendayonfire.mongodb
when: "'mongo_master' in group_names"
- hosts: "{{ target | default('mongo') }}"
become: no
gather_facts: yes
roles:
- role: greendayonfire.mongodb
when: "'mongo_replicas' in group_names"