Skip to content
Snippets Groups Projects
main.yml 3.42 KiB
---

- name: add role requirement
  apt:
    force_apt_get: true
    name: "{{ rc_apt_packages_requirements }}"
    update_cache: true
    cache_valid_time: 3600
    state: present

- name: add group
  group:
    name: "{{ rc_group }}"
    system: true
    state: present

- name: add user
  user:
    name: "{{ rc_user }}"
    group: "{{ rc_group }}"
    home: /var/run/{{ rc_user }}
    shell: /usr/bin/nologin
    system: true
    state: present

- name: add mongodb repository key
  apt_key:
    url: "{{ rc_mongo_repo_key_url }}"
    state: present

- name: add mongodb repository
  apt_repository:
    repo: "{{ rc_mongo_repo }}"
    filename: "{{ rc_mongo_repo_file }}"
    state: present

- name: add nodesource repository key
  apt_key:
    url: "{{ rc_node_repo_key_url }}"
    state: present

- name: add nodesource repository
  apt_repository:
    repo: "{{ rc_node_repo }}"
    filename: "{{ rc_node_repo_file }}"
    state: present

- name: install system requirements
  apt:
    force_apt_get: true
    name: "{{ rc_apt_packages }}"
    update_cache: true
    cache_valid_time: 3600
    state: present

- name: set mongodb engine
  notify: restart mongodb
  lineinfile:
    path: /etc/mongod.conf
    regexp: '^#?  engine:'
    line: '  engine: mmapv1'

- name: set mongodb replset name
  notify:
    - restart mongodb
    - initialize mongodb
  blockinfile:
    path: /etc/mongod.conf
    block: |
      replication: