prepare base installation

This commit is contained in:
Robert Kaussow 2018-07-05 23:16:57 +02:00
parent 683ded1821
commit be9b221358
3 changed files with 45 additions and 19 deletions

9
defaults/main.yml Normal file
View File

@ -0,0 +1,9 @@
---
mongodb_version: 3.6
mongodb_system_user: mongod
mongodb_system_group: mongod
mongodb_storage_dbpath:
# mongodb_system_gid: omit
# mongodb_system_uid: omit

View File

@ -1,9 +1,8 @@
--- ---
- name: Restart mongodb - name: Restart mongod service
systemd: systemd:
name: mongod name: mongod
state: restarted state: restarted
enabled: yes enabled: yes
daemon_reload: yes daemon_reload: yes
listen: listen: __mongod_restart
- "mongod_restart"

View File

@ -1,28 +1,46 @@
--- ---
- block: - block:
- name: Add mongodb repo - name: Add repository for major version '{{ mongodb_version }}'
yum_repository: yum_repository:
name: mongodb-org-3.4 name: mongodb
description: MongoDB Repository description: MongoDB Repository
baseurl: https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/ baseurl: "https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/{{ mongodb_version }}/x86_64/"
gpgcheck: yes gpgcheck: yes
enabled: yes enabled: yes
gpgkey: https://www.mongodb.org/static/pgp/server-3.4.asc gpgkey: "https://www.mongodb.org/static/pgp/server-{{ mongodb_version }}.asc"
notify:
- mongod_restart
- name: Install mongodb package - name: Install package
package: package:
name: mongodb-org name: mongodb-org
state: latest state: present
notify:
- mongod_restart
- name: Make sure mongodb is running # - name: Create system group '{{ mongodb_system_group }}'
systemd: # group:
name: mongod # name: "{{ mongodb_system_group }}"
state: started # gid: "{{ mongodb_system_gid | default(omit) }}"
enabled: yes # state: present
daemon_reload: yes #
# - name: Create system user '{{ mongodb_system_user }}'
# user:
# name: "{{ mongodb_system_user }}"
# uid: "{{ mongodb_system_uid | default(omit) }}"
# group: "{{ mongodb_system_group }}"
# notify: __mongod_restart
#
# - name: Create db storage dir at '{{ mongodb_storage_dbpath }}'
# file:
# path: "{{ mongodb_storage_dbpath }}"
# owner: "{{ mongodb_system_user }}"
# group: "{{ mongodb_system_group }}"
# follow: yes
# recurse: yes
# state: directory
#
# - name: Make sure mongodb is running
# systemd:
# name: mongod
# state: started
# enabled: yes
# daemon_reload: yes
become: True become: True
become_user: root become_user: root