From 3428052604e0852bcab8c043b09562caec08df11 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 24 Mar 2016 15:41:14 +0100 Subject: [PATCH] library/roles/mongodb-org/defaults/main.yml: /etc/default/mongod is now a template. dnet-openaire/inventory/hosts: node7.t.openaire is not used anymore. dnet-openaire/inventory/hosts.stdl: The project ended. --- .../tasks/dnet-groups.yml | 6 +- mongodb-org/defaults/main.yml | 5 +- mongodb-org/handlers/main.yml | 7 +- mongodb-org/tasks/mongodb.yml | 3 +- mongodb-org/templates/mongod-default.j2 | 6 ++ mongodb-org/templates/mongodb-2.4.conf.j2 | 87 ------------------- 6 files changed, 17 insertions(+), 97 deletions(-) create mode 100644 mongodb-org/templates/mongod-default.j2 delete mode 100644 mongodb-org/templates/mongodb-2.4.conf.j2 diff --git a/dnet_user_services_perms/tasks/dnet-groups.yml b/dnet_user_services_perms/tasks/dnet-groups.yml index d04599e3..1618e748 100644 --- a/dnet_user_services_perms/tasks/dnet-groups.yml +++ b/dnet_user_services_perms/tasks/dnet-groups.yml @@ -8,18 +8,18 @@ - name: Add all the users to the dnet group user: name={{ item.login }} groups={{ dnet_group }}, append=yes - with_items: users_system_users + with_items: '{{ users_system_users | default([]) }}' tags: [ 'dnet', 'users' ] - name: Add selected users to the dnet sudoers group user: name={{ item.login }} groups={{ dnet_sudoers_group }}, append=yes - with_items: users_system_users + with_items: '{{ users_system_users | default([]) }}' when: item.dnet_sudoers_user tags: [ 'dnet', 'users' ] - name: Remove selected users to the dnet sudoers group user: name={{ item.login }} groups={{ dnet_group }} - with_items: users_system_users + with_items: '{{ users_system_users | default([]) }}' when: not item.dnet_sudoers_user tags: [ 'dnet', 'users' ] diff --git a/mongodb-org/defaults/main.yml b/mongodb-org/defaults/main.yml index eed15b2b..68b0abc6 100644 --- a/mongodb-org/defaults/main.yml +++ b/mongodb-org/defaults/main.yml @@ -11,11 +11,14 @@ mongodb_http_port: 28017 mongodb_user: mongodb mongodb_group: mongodb mongodb_logdir: /var/log/mongodb -mongodb_log_file: mongodb.log +mongodb_log_file: mongod.log mongodb_logpath: '{{ mongodb_logdir }}/{{ mongodb_log_file }}' mongodb_dbpath: /var/lib/mongodb mongodb_log_retain_days: 7 mongodb_directoryperdb: False +mongodb_conf_file: /etc/mongod.conf +mongodb_daemon: /usr/bin/mongod +mongod_additional_options: "" mongodb_allowed_hosts: - 127.0.0.1/8 - '{{ ansible_default_ipv4.address }}/32' diff --git a/mongodb-org/handlers/main.yml b/mongodb-org/handlers/main.yml index b90f828c..6402054c 100644 --- a/mongodb-org/handlers/main.yml +++ b/mongodb-org/handlers/main.yml @@ -1,7 +1,4 @@ --- -- name: Update apt cache - apt: update_cache=yes - ignore_errors: true - - name: Restart mongodb - service: name=mongodb state=restarted + service: name=mongod state=restarted + when: "'{{ mongodb_start_server }}' == 'yes'" diff --git a/mongodb-org/tasks/mongodb.yml b/mongodb-org/tasks/mongodb.yml index c5c88a42..6a41c14f 100644 --- a/mongodb-org/tasks/mongodb.yml +++ b/mongodb-org/tasks/mongodb.yml @@ -21,7 +21,7 @@ tags: mongodb - name: Install the mongodb defaults file - copy: content="ENABLE_MONGODB={{ mongodb_start_server }}" dest=/etc/default/mongodb owner=root group=root mode=0444 + template: src=mongod-default.j2 dest=/etc/default/mongod owner=root group=root mode=0444 when: mongodb_install_conf tags: mongodb @@ -38,6 +38,7 @@ - name: Install the mongodb 2.6 configuration template: src=mongod-2.6.conf.j2 dest=/etc/mongod.conf owner=root group=root mode=0444 when: mongodb_install_conf + notify: Restart mongodb tags: mongodb - name: Install the cron job that manages log files rotation diff --git a/mongodb-org/templates/mongod-default.j2 b/mongodb-org/templates/mongod-default.j2 new file mode 100644 index 00000000..6fd002d8 --- /dev/null +++ b/mongodb-org/templates/mongod-default.j2 @@ -0,0 +1,6 @@ +ENABLE_MONGOD="{{ mongodb_start_server }}" +CONF={{ mongodb_conf_file }} +DAEMON={{ mongodb_daemon }} +DAEMONUSER={{ mongodb_user }} +DAEMON_OPTS="{{ mongod_additional_options }} --config $CONF" + diff --git a/mongodb-org/templates/mongodb-2.4.conf.j2 b/mongodb-org/templates/mongodb-2.4.conf.j2 deleted file mode 100644 index 47ea9f27..00000000 --- a/mongodb-org/templates/mongodb-2.4.conf.j2 +++ /dev/null @@ -1,87 +0,0 @@ -# Note: if you run mongodb as a non-root user (recommended) you may -# need to create and set permissions for this directory manually, -# e.g., if the parent directory isn't mutable by the mongodb user. -dbpath={{ mongodb_dbpath }} -directoryperdb={{ mongodb_directoryperdb }} - -#where to log -logpath={{ mongodb_logpath }} - -logappend=true - -port = {{ mongodb_tcp_port }} - -# Disables write-ahead journaling -# nojournal = true - -# Enables periodic logging of CPU utilization and I/O wait -#cpu = true - -# Turn on/off security. Off is currently the default -#noauth = true -#auth = true - -# Verbose logging output. -#verbose = true - -# Inspect all client data for validity on receipt (useful for -# developing drivers) -#objcheck = true - -# Enable db quota management -#quota = true - -# Set oplogging level where n is -# 0=off (default) -# 1=W -# 2=R -# 3=both -# 7=W+some reads -#diaglog = 0 -# Ignore query hints -#nohints = true - -{% if not mongodb_http_interface %} -# Disable the HTTP interface (Defaults to localhost:28017). -nohttpinterface = true -{% endif %} - -# Turns off server-side scripting. This will result in greatly limited -# functionality -#noscripting = true - -# Turns off table scans. Any query that would do a table scan fails. -#notablescan = true - -# Disable data file preallocation. -#noprealloc = true - -# Specify .ns file size for new databases. -# nssize = - -# Accout token for Mongo monitoring server. -#mms-token = - -# Server name for Mongo monitoring server. -#mms-name = - -# Ping interval for Mongo monitoring server. -#mms-interval = - -# Replication Options - -# in master/slave replicated mongo databases, specify here whether -# this is a slave or master -#slave = true -#source = master.example.com -# Slave only: specify a single database to replicate -#only = master.example.com -# or -#master = true -#source = slave.example.com - -{% if mongodb_cluster_enabled %} -# in replica set configuration, specify the name of the replica set -replSet = {{ mongodb_replicaset }} -{% endif %} -