Fixed for Ansible 2.8

This commit is contained in:
Sergei Antipov 2019-05-25 22:52:10 -04:00
parent 852ad2149e
commit 5ee8162161
No known key found for this signature in database
GPG Key ID: B167B87787407B3A
5 changed files with 17 additions and 25 deletions

View File

@ -7,15 +7,15 @@
- name: mongodb reload
service: name={{ mongodb_daemon_name }} state=reloaded
when: mongodb_manage_service
when: mongodb_manage_service|bool
- name: mongodb restart
service: name={{ mongodb_daemon_name }} state=restarted
when: mongodb_manage_service
when: mongodb_manage_service|bool
- name: mongodb-mms-monitoring-agent restart
service: name=mongodb-mms-monitoring-agent state=restarted
when: mongodb_manage_service
when: mongodb_manage_service|bool
- name: restart sysfsutils
service: name=sysfsutils state=restarted

View File

@ -7,14 +7,14 @@
owner: "{{ mongodb_user }}"
group: "root"
mode: 0600
when: mongodb_replication_replset|default("") != ""
when: mongodb_replication_replset | length > 0
- name: set mongodb gid
group:
name: "{{ mongodb_user }}"
gid: "{{ mongodb_gid }}"
state: present
when: mongodb_gid
when: mongodb_gid | length > 0
- name: set mongodb uid
user:
@ -22,7 +22,7 @@
uid: "{{ mongodb_uid }}"
group: "{{ mongodb_user }}"
state: present
when: mongodb_uid
when: mongodb_uid | length > 0
- name: Create log dir if missing
file:

View 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
set_fact:
mongodb_major_version: "{{ mongodb_version[0:3] }}"
@ -13,7 +6,7 @@
- name: Disable transparent huge pages on systemd systems
include_tasks: disable_transparent_hugepages.yml
when:
- mongodb_disable_transparent_hugepages
- mongodb_disable_transparent_hugepages | bool
- ansible_service_mgr == "systemd"
- name: Add APT key
@ -29,7 +22,7 @@
(mongodb_version is not defined
or mongodb_repository[mongodb_major_version] is not defined
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
fail:
@ -83,11 +76,11 @@
pkg:
- python-dev
- 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

View File

@ -32,10 +32,9 @@
- name: Install PIP
yum:
name: "{{ item }}"
with_items:
- python-devel
- python-pip
name:
- python-devel
- python-pip
when: mongodb_pymongo_from_pip
- name: Install PyMongo from PIP

View File

@ -20,14 +20,14 @@
- name: Include replication and auth configuration
include: replication_init_auth.yml
when: ( mongodb_replication_replset is defined
when: ( mongodb_replication_replset | length > 0
and mongodb_security_authorization == 'enabled'
and mongodb_master is defined and mongodb_master )
tags: [mongodb]
- name: Include replication configuration
include: replication.yml
when: mongodb_replication_replset is defined and mongodb_replication_replset
when: mongodb_replication_replset | lenght > 0
tags: [mongodb]
- name: Check where admin user already exists
@ -101,7 +101,7 @@
login_host: "{{ mongodb_login_host|default('localhost') }}"
with_items:
- "{{ mongodb_oplog_users | default([]) }}"
when: ( mongodb_replication_replset
when: ( mongodb_replication_replset | lenght > 0
and mongodb_security_authorization == 'enabled'
and mongodb_master is defined and mongodb_master )
no_log: false
@ -109,5 +109,5 @@
- name: Include MMS Agent configuration
include: mms-agent.yml
when: mongodb_mms_api_key
when: mongodb_mms_api_key | lenght > 0
tags: [mongodb]