Skip to content

Commit fb8c3f1

Browse files
authored
Merge pull request #164 from UnderGreen/ansible_lint
Ansible lint
2 parents 8103d27 + 02f3334 commit fb8c3f1

21 files changed

+228
-660
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ env:
4848
DISTRIBUTION=debian
4949
DIST_VERSION=9-builded
5050
MONGODB_VERSION=3.6
51-
MONGODB_PACKAGE=mongodb-org
5251
- >
5352
DISTRIBUTION=debian
5453
DIST_VERSION=8-builded

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,8 @@ mongodb_security_keyfile: /etc/mongodb-keyfile # Specify path to keyfile with pa
7070
mongodb_storage_dbpath: /data/db # Directory for datafiles
7171
mongodb_storage_dirperdb: false # Use one directory per DB
7272

73-
# The storage engine for the mongod database. Available values:
74-
# 'mmapv1', 'wiredTiger'
75-
mongodb_storage_engine: "{{ 'mmapv1' if mongodb_version[0:3] == '3.0' else 'wiredTiger' }}"
73+
# The storage engine for the mongod database
74+
mongodb_storage_engine: "wiredTiger"
7675
# mmapv1 specific options
7776
mongodb_storage_quota_enforced: false # Limits each database to a certain number of files
7877
mongodb_storage_quota_maxfiles: 8 # Number of quota files per DB

defaults/main.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
mongodb_package: mongodb-org
44
mongodb_package_state: present
5-
mongodb_version: "3.6"
5+
mongodb_version: "4.0"
66
mongodb_apt_keyserver: keyserver.ubuntu.com
77
mongodb_apt_key_id:
88
"3.4": "0C49F3730359A14518585931BC711F9BA15703C6"
@@ -29,8 +29,8 @@ mongodb_net_ipv6: false # Enable IPv6 support (disabled
2929
mongodb_net_maxconns: 65536 # Max number of simultaneous connections
3030
mongodb_net_port: 27017 # Specify port number
3131
mongodb_net_ssl: disabled # Enable or disable ssl connections
32-
mongodb_net_ssl_mode: # Set the ssl mode (RequireSSL / preferSSL / AllowSSL / disabled)
33-
mongodb_net_ssl_pemfile: # Location of the pemfile to use for ssl
32+
mongodb_net_ssl_mode: "" # Set the ssl mode (RequireSSL / preferSSL / AllowSSL / disabled)
33+
mongodb_net_ssl_pemfile: "" # Location of the pemfile to use for ssl
3434

3535
## processManagement Options
3636
# Fork server process
@@ -47,8 +47,7 @@ mongodb_security_javascript_enabled: false
4747
mongodb_storage_dbpath: /data/db # Directory for datafiles
4848
mongodb_storage_dirperdb: false # Use one directory per DB
4949

50-
# The storage engine for the mongod database. Available values:
51-
# 'mmapv1', 'wiredTiger'
50+
# The storage engine for the mongod database
5251
mongodb_storage_engine: "wiredTiger"
5352
# mmapv1 specific options
5453
mongodb_storage_quota_enforced: false # Limits each database to a certain number of files
@@ -73,7 +72,7 @@ mongodb_operation_profiling_slow_op_threshold_ms: 100
7372
mongodb_operation_profiling_mode: "off"
7473

7574
## replication Options
76-
mongodb_replication_replset: # Enable replication <setname>[/<optionalseedhostlist>]
75+
mongodb_replication_replset: "" # Enable replication
7776
mongodb_replication_replindexprefetch: "all" # specify index prefetching behavior (if secondary) [none|_id_only|all]
7877
mongodb_replication_oplogsize: 1024 # specifies a maximum size in megabytes for the replication operation log
7978

files/disable-transparent-hugepages.init

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[Unit]
2+
Description="Disable Transparent Hugepage before MongoDB boots"
3+
#WARN: check service name on your system
4+
# If you are using MongoDB Cloud, service name is "mongodb-mms-automation-agent.service"
5+
Before=mongodb.service
6+
7+
[Service]
8+
Type=oneshot
9+
ExecStart=-/bin/bash -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled'
10+
ExecStart=-/bin/bash -c 'echo never > /sys/kernel/mm/transparent_hugepage/defrag'
11+
ExecStart=-/bin/bash -c 'echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled'
12+
ExecStart=-/bin/bash -c 'echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag'
13+
ExecStart=-/bin/bash -c 'echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag'
14+
ExecStart=-/bin/bash -c 'echo 0 > /sys/kernel/mm/redhat_transparent_hugepage/khugepaged/defrag'
15+
ExecStart=-/bin/bash -c 'echo no > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag'
16+
ExecStart=-/bin/bash -c 'echo no > /sys/kernel/mm/redhat_transparent_hugepage/khugepaged/defrag'
17+
18+
[Install]
19+
#WARN: check service name on your system
20+
# If you are using MongoDB Cloud, service name is "mongodb-mms-automation-agent.service"
21+
RequiredBy=mongodb.service

handlers/main.yml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,40 @@
11
---
22

3+
- name: reload systemd
4+
systemd:
5+
daemon_reload: yes
6+
when: ansible_service_mgr == "systemd" and mongodb_manage_service
7+
38
- name: mongodb reload
49
service: name={{ mongodb_daemon_name }} state=reloaded
5-
when: mongodb_manage_service
10+
when: mongodb_manage_service|bool
611

712
- name: mongodb restart
813
service: name={{ mongodb_daemon_name }} state=restarted
9-
when: mongodb_manage_service
14+
when: mongodb_manage_service|bool
1015

1116
- name: mongodb-mms-monitoring-agent restart
1217
service: name=mongodb-mms-monitoring-agent state=restarted
13-
when: mongodb_manage_service
14-
15-
- name: reload systemd
16-
shell: systemctl daemon-reload
17-
when: mongodb_is_systemd and mongodb_manage_service
18+
when: mongodb_manage_service|bool
1819

1920
- name: restart sysfsutils
2021
service: name=sysfsutils state=restarted
22+
23+
- name: service started
24+
service:
25+
name: "{{ mongodb_daemon_name }}"
26+
state: started
27+
28+
- name: wait when mongodb is started
29+
wait_for:
30+
host: "{{ item }}"
31+
port: "{{ mongodb_net_port }}"
32+
timeout: 120
33+
with_items: "{{ mongodb_net_bindip.split(',') | map('replace', '0.0.0.0', '127.0.0.1') | list }}"
34+
35+
- name: wait when mongodb is started on localhost
36+
wait_for:
37+
host: "127.0.0.1"
38+
port: "{{ mongodb_net_port }}"
39+
delay: 5
40+
timeout: 120

0 commit comments

Comments
 (0)