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