Skip to content

Commit

Permalink
Merge pull request #164 from UnderGreen/ansible_lint
Browse files Browse the repository at this point in the history
Ansible lint
  • Loading branch information
UnderGreen authored May 29, 2019
2 parents 8103d27 + 02f3334 commit fb8c3f1
Show file tree
Hide file tree
Showing 21 changed files with 228 additions and 660 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ mongodb_security_keyfile: /etc/mongodb-keyfile # Specify path to keyfile with pa
mongodb_storage_dbpath: /data/db # Directory for datafiles
mongodb_storage_dirperdb: false # Use one directory per DB

# The storage engine for the mongod database. Available values:
# 'mmapv1', 'wiredTiger'
mongodb_storage_engine: "{{ 'mmapv1' if mongodb_version[0:3] == '3.0' else 'wiredTiger' }}"
# The storage engine for the mongod database
mongodb_storage_engine: "wiredTiger"
# mmapv1 specific options
mongodb_storage_quota_enforced: false # Limits each database to a certain number of files
mongodb_storage_quota_maxfiles: 8 # Number of quota files per DB
Expand Down
11 changes: 5 additions & 6 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

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

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

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

Expand Down
10 changes: 0 additions & 10 deletions files/disable-transparent-hugepages.init

This file was deleted.

21 changes: 21 additions & 0 deletions files/disable-transparent-hugepages.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[Unit]
Description="Disable Transparent Hugepage before MongoDB boots"
#WARN: check service name on your system
# If you are using MongoDB Cloud, service name is "mongodb-mms-automation-agent.service"
Before=mongodb.service

[Service]
Type=oneshot
ExecStart=-/bin/bash -c 'echo never > /sys/kernel/mm/transparent_hugepage/enabled'
ExecStart=-/bin/bash -c 'echo never > /sys/kernel/mm/transparent_hugepage/defrag'
ExecStart=-/bin/bash -c 'echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled'
ExecStart=-/bin/bash -c 'echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag'
ExecStart=-/bin/bash -c 'echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag'
ExecStart=-/bin/bash -c 'echo 0 > /sys/kernel/mm/redhat_transparent_hugepage/khugepaged/defrag'
ExecStart=-/bin/bash -c 'echo no > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag'
ExecStart=-/bin/bash -c 'echo no > /sys/kernel/mm/redhat_transparent_hugepage/khugepaged/defrag'

[Install]
#WARN: check service name on your system
# If you are using MongoDB Cloud, service name is "mongodb-mms-automation-agent.service"
RequiredBy=mongodb.service
34 changes: 27 additions & 7 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
---

- name: reload systemd
systemd:
daemon_reload: yes
when: ansible_service_mgr == "systemd" and mongodb_manage_service

- 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

- name: reload systemd
shell: systemctl daemon-reload
when: mongodb_is_systemd and mongodb_manage_service
when: mongodb_manage_service|bool

- name: restart sysfsutils
service: name=sysfsutils state=restarted

- name: service started
service:
name: "{{ mongodb_daemon_name }}"
state: started

- name: wait when mongodb is started
wait_for:
host: "{{ item }}"
port: "{{ mongodb_net_port }}"
timeout: 120
with_items: "{{ mongodb_net_bindip.split(',') | map('replace', '0.0.0.0', '127.0.0.1') | list }}"

- name: wait when mongodb is started on localhost
wait_for:
host: "127.0.0.1"
port: "{{ mongodb_net_port }}"
delay: 5
timeout: 120
Loading

0 comments on commit fb8c3f1

Please sign in to comment.