Few more fixes
This commit is contained in:
parent
606210c767
commit
79aea9ac40
|
@ -48,7 +48,6 @@ env:
|
|||
DISTRIBUTION=debian
|
||||
DIST_VERSION=9-builded
|
||||
MONGODB_VERSION=3.6
|
||||
MONGODB_PACKAGE=mongodb-org
|
||||
- >
|
||||
DISTRIBUTION=debian
|
||||
DIST_VERSION=8-builded
|
||||
|
|
|
@ -18,8 +18,8 @@ mongodb_manage_service: true
|
|||
mongodb_disable_transparent_hugepages: false
|
||||
|
||||
mongodb_user: "{{ 'mongod' if ('RedHat' == ansible_os_family) else 'mongodb' }}"
|
||||
mongodb_uid: ""
|
||||
mongodb_gid: ""
|
||||
mongodb_uid:
|
||||
mongodb_gid:
|
||||
mongodb_daemon_name: "{{ 'mongod' if ('mongodb-org' in mongodb_package) else 'mongodb' }}"
|
||||
|
||||
## net Options
|
||||
|
|
|
@ -1,7 +1,31 @@
|
|||
---
|
||||
- name: create mongodb group
|
||||
group:
|
||||
name: "{{ mongodb_user }}"
|
||||
state: present
|
||||
|
||||
- debug:
|
||||
msg: "{{ mongodb_replication_replset }}"
|
||||
- name: create mongodb user
|
||||
user:
|
||||
name: "{{ mongodb_user }}"
|
||||
group: "{{ mongodb_user }}"
|
||||
state: present
|
||||
|
||||
# Workaround because default(omit) is not working. At least in Ansible 2.8.
|
||||
|
||||
- name: set mongodb gid
|
||||
group:
|
||||
name: "{{ mongodb_user }}"
|
||||
gid: "{{ mongodb_gid }}"
|
||||
state: present
|
||||
when: mongodb_gid is defined
|
||||
|
||||
- name: set mongodb uid
|
||||
user:
|
||||
name: "{{ mongodb_user }}"
|
||||
uid: "{{ mongodb_uid }}"
|
||||
group: "{{ mongodb_user }}"
|
||||
state: present
|
||||
when: mongodb_uid is defined
|
||||
|
||||
- name: Create keyFile
|
||||
copy:
|
||||
|
@ -12,21 +36,6 @@
|
|||
mode: 0600
|
||||
when: mongodb_replication_replset | length > 0
|
||||
|
||||
- name: set mongodb gid
|
||||
group:
|
||||
name: "{{ mongodb_user }}"
|
||||
gid: "{{ mongodb_gid }}"
|
||||
state: present
|
||||
when: mongodb_gid | length > 0
|
||||
|
||||
- name: set mongodb uid
|
||||
user:
|
||||
name: "{{ mongodb_user }}"
|
||||
uid: "{{ mongodb_uid }}"
|
||||
group: "{{ mongodb_user }}"
|
||||
state: present
|
||||
when: mongodb_uid | length > 0
|
||||
|
||||
- name: Create log dir if missing
|
||||
file:
|
||||
state: directory
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
- name: Add systemd configuration if present
|
||||
copy: src=mongodb.service dest=/lib/systemd/system/mongodb.service owner=root group=root mode=0644
|
||||
when: ansible_service_mgr == "systemd"
|
||||
notify:
|
||||
- reload systemd
|
||||
|
||||
- name: Add symlink for systemd
|
||||
file: src=/lib/systemd/system/mongodb.service dest=/etc/systemd/system/multi-user.target.wants/mongodb.service state=link
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
dest: /etc/yum.repos.d/mongodb.repo
|
||||
mode: 0644
|
||||
with_items: "{{ mongodb_major_version }}"
|
||||
loop_control:
|
||||
loop_var: version_item
|
||||
when: mongodb_package == 'mongodb-org'
|
||||
|
||||
- name: Install MongoDB package
|
||||
|
@ -38,11 +40,11 @@
|
|||
name:
|
||||
- python-devel
|
||||
- python-pip
|
||||
when: mongodb_pymongo_from_pip
|
||||
when: mongodb_pymongo_from_pip | bool
|
||||
|
||||
- name: Install PyMongo from PIP
|
||||
pip:
|
||||
name: pymongo
|
||||
state: "{{ mongodb_pymongo_pip_version is defined | ternary('present', 'latest') }}"
|
||||
version: "{{ mongodb_pymongo_pip_version | default(omit) }}"
|
||||
when: mongodb_pymongo_from_pip
|
||||
when: mongodb_pymongo_from_pip | bool
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
[mongodb-org-{{ mongodb_major_version }}]
|
||||
name=MongoDB {{ mongodb_major_version }} Repository
|
||||
baseurl={{ mongodb_repository[item] }}
|
||||
{% if mongodb_repository_gpgkey[item] is defined and mongodb_repository_gpgkey[item] != '' %}
|
||||
baseurl={{ mongodb_repository[version_item] }}
|
||||
{% if mongodb_repository_gpgkey[version_item] is defined and mongodb_repository_gpgkey[version_item] != '' %}
|
||||
gpgcheck=1
|
||||
gpgkey={{ mongodb_repository_gpgkey[item] }}
|
||||
gpgkey={{ mongodb_repository_gpgkey[version_item] }}
|
||||
{% else %}
|
||||
gpgcheck=0
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue