Fixed for Ansible 2.8
This commit is contained in:
parent
852ad2149e
commit
5ee8162161
|
@ -7,15 +7,15 @@
|
||||||
|
|
||||||
- name: mongodb reload
|
- name: mongodb reload
|
||||||
service: name={{ mongodb_daemon_name }} state=reloaded
|
service: name={{ mongodb_daemon_name }} state=reloaded
|
||||||
when: mongodb_manage_service
|
when: mongodb_manage_service|bool
|
||||||
|
|
||||||
- name: mongodb restart
|
- name: mongodb restart
|
||||||
service: name={{ mongodb_daemon_name }} state=restarted
|
service: name={{ mongodb_daemon_name }} state=restarted
|
||||||
when: mongodb_manage_service
|
when: mongodb_manage_service|bool
|
||||||
|
|
||||||
- name: mongodb-mms-monitoring-agent restart
|
- name: mongodb-mms-monitoring-agent restart
|
||||||
service: name=mongodb-mms-monitoring-agent state=restarted
|
service: name=mongodb-mms-monitoring-agent state=restarted
|
||||||
when: mongodb_manage_service
|
when: mongodb_manage_service|bool
|
||||||
|
|
||||||
- name: restart sysfsutils
|
- name: restart sysfsutils
|
||||||
service: name=sysfsutils state=restarted
|
service: name=sysfsutils state=restarted
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
owner: "{{ mongodb_user }}"
|
owner: "{{ mongodb_user }}"
|
||||||
group: "root"
|
group: "root"
|
||||||
mode: 0600
|
mode: 0600
|
||||||
when: mongodb_replication_replset|default("") != ""
|
when: mongodb_replication_replset | length > 0
|
||||||
|
|
||||||
- name: set mongodb gid
|
- name: set mongodb gid
|
||||||
group:
|
group:
|
||||||
name: "{{ mongodb_user }}"
|
name: "{{ mongodb_user }}"
|
||||||
gid: "{{ mongodb_gid }}"
|
gid: "{{ mongodb_gid }}"
|
||||||
state: present
|
state: present
|
||||||
when: mongodb_gid
|
when: mongodb_gid | length > 0
|
||||||
|
|
||||||
- name: set mongodb uid
|
- name: set mongodb uid
|
||||||
user:
|
user:
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
uid: "{{ mongodb_uid }}"
|
uid: "{{ mongodb_uid }}"
|
||||||
group: "{{ mongodb_user }}"
|
group: "{{ mongodb_user }}"
|
||||||
state: present
|
state: present
|
||||||
when: mongodb_uid
|
when: mongodb_uid | length > 0
|
||||||
|
|
||||||
- name: Create log dir if missing
|
- name: Create log dir if missing
|
||||||
file:
|
file:
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: Check if running on systemd
|
|
||||||
stat: path=/sbin/init
|
|
||||||
register: sbin_init
|
|
||||||
changed_when: false
|
|
||||||
check_mode: no
|
|
||||||
|
|
||||||
- name: Establish some role-related facts
|
- name: Establish some role-related facts
|
||||||
set_fact:
|
set_fact:
|
||||||
mongodb_major_version: "{{ mongodb_version[0:3] }}"
|
mongodb_major_version: "{{ mongodb_version[0:3] }}"
|
||||||
|
@ -13,7 +6,7 @@
|
||||||
- name: Disable transparent huge pages on systemd systems
|
- name: Disable transparent huge pages on systemd systems
|
||||||
include_tasks: disable_transparent_hugepages.yml
|
include_tasks: disable_transparent_hugepages.yml
|
||||||
when:
|
when:
|
||||||
- mongodb_disable_transparent_hugepages
|
- mongodb_disable_transparent_hugepages | bool
|
||||||
- ansible_service_mgr == "systemd"
|
- ansible_service_mgr == "systemd"
|
||||||
|
|
||||||
- name: Add APT key
|
- name: Add APT key
|
||||||
|
@ -29,7 +22,7 @@
|
||||||
(mongodb_version is not defined
|
(mongodb_version is not defined
|
||||||
or mongodb_repository[mongodb_major_version] is not defined
|
or mongodb_repository[mongodb_major_version] is not defined
|
||||||
or (mongodb_version != '3.6' and mongodb_version != '4.0'))
|
or (mongodb_version != '3.6' and mongodb_version != '4.0'))
|
||||||
and (ansible_distribution_release == 'stretch' and ansible_distribution_release == 'jessie'))
|
and ansible_distribution_release == 'stretch')
|
||||||
|
|
||||||
- name: Fail when used wrong mongodb_version variable with Ubuntu 18.04
|
- name: Fail when used wrong mongodb_version variable with Ubuntu 18.04
|
||||||
fail:
|
fail:
|
||||||
|
@ -83,11 +76,11 @@
|
||||||
pkg:
|
pkg:
|
||||||
- python-dev
|
- python-dev
|
||||||
- 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
|
||||||
|
|
|
@ -32,10 +32,9 @@
|
||||||
|
|
||||||
- name: Install PIP
|
- name: Install PIP
|
||||||
yum:
|
yum:
|
||||||
name: "{{ item }}"
|
name:
|
||||||
with_items:
|
- python-devel
|
||||||
- python-devel
|
- python-pip
|
||||||
- python-pip
|
|
||||||
when: mongodb_pymongo_from_pip
|
when: mongodb_pymongo_from_pip
|
||||||
|
|
||||||
- name: Install PyMongo from PIP
|
- name: Install PyMongo from PIP
|
||||||
|
|
|
@ -20,14 +20,14 @@
|
||||||
|
|
||||||
- name: Include replication and auth configuration
|
- name: Include replication and auth configuration
|
||||||
include: replication_init_auth.yml
|
include: replication_init_auth.yml
|
||||||
when: ( mongodb_replication_replset is defined
|
when: ( mongodb_replication_replset | length > 0
|
||||||
and mongodb_security_authorization == 'enabled'
|
and mongodb_security_authorization == 'enabled'
|
||||||
and mongodb_master is defined and mongodb_master )
|
and mongodb_master is defined and mongodb_master )
|
||||||
tags: [mongodb]
|
tags: [mongodb]
|
||||||
|
|
||||||
- name: Include replication configuration
|
- name: Include replication configuration
|
||||||
include: replication.yml
|
include: replication.yml
|
||||||
when: mongodb_replication_replset is defined and mongodb_replication_replset
|
when: mongodb_replication_replset | lenght > 0
|
||||||
tags: [mongodb]
|
tags: [mongodb]
|
||||||
|
|
||||||
- name: Check where admin user already exists
|
- name: Check where admin user already exists
|
||||||
|
@ -101,7 +101,7 @@
|
||||||
login_host: "{{ mongodb_login_host|default('localhost') }}"
|
login_host: "{{ mongodb_login_host|default('localhost') }}"
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ mongodb_oplog_users | default([]) }}"
|
- "{{ mongodb_oplog_users | default([]) }}"
|
||||||
when: ( mongodb_replication_replset
|
when: ( mongodb_replication_replset | lenght > 0
|
||||||
and mongodb_security_authorization == 'enabled'
|
and mongodb_security_authorization == 'enabled'
|
||||||
and mongodb_master is defined and mongodb_master )
|
and mongodb_master is defined and mongodb_master )
|
||||||
no_log: false
|
no_log: false
|
||||||
|
@ -109,5 +109,5 @@
|
||||||
|
|
||||||
- name: Include MMS Agent configuration
|
- name: Include MMS Agent configuration
|
||||||
include: mms-agent.yml
|
include: mms-agent.yml
|
||||||
when: mongodb_mms_api_key
|
when: mongodb_mms_api_key | lenght > 0
|
||||||
tags: [mongodb]
|
tags: [mongodb]
|
||||||
|
|
Loading…
Reference in New Issue