summaryrefslogtreecommitdiff
path: root/test/integration/targets/setup_mongodb_v4/tasks/setup_mongodb.yml
blob: e1b2c327958f27e0e08c8d823c3aa0db5dbdf917 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Copyright 2020, Andrew Klychkov <aaklychkov@mail.ru>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

- name: Set up repo
  yum_repository:
    name: '{{ mongodb_repo_name }}'
    description: '{{ mongodb_repo_descr }}'
    baseurl: '{{ mongodb_repo_link }}'
    gpgkey: '{{ mongodb_gpgkey }}'
    gpgcheck: yes

- name: Install MongoDB packages
  yum:
    name: '{{ mongodb_pkgs }}'
    state: present
  notify: Remove MongoDB packages

- name: Install pymongo
  shell: git clone '{{ pymongo_repo }}' pymongo && cd pymongo/ && python setup.py install

- name: Start MongoDB
  systemd:
    name: mongod.service
    state: started
  notify: Stop MongoDB

- name: Create admin user
  mongodb_user:
    login_port: '{{ mongodb_default_port }}'
    database: '{{ mongodb_default_db }}'
    name: '{{ mongodb_admin_user }}'
    password: '{{ mongodb_admin_password }}'
    roles: root
    state: present