Update the role

This commit is contained in:
Kirill Klenov 2014-12-11 22:09:31 +03:00
parent 53c725c6f1
commit fa4b1a0d39
5 changed files with 49 additions and 28 deletions

View File

@ -67,7 +67,7 @@ Example:
- Stouts.mongodb
vars:
port: 27400
mongodb_conf_port: 27400
```
#### License

View File

@ -6,27 +6,24 @@ mongodb_packages:
- python-pymongo
- mongodb-org
mongodb_conf:
auth: "false"
bind_ip: 127.0.0.1
cpu: "true"
dbpath: /var/lib/mongodb/
# diaglog: 0 # deprecated
logappend: "true"
logpath: /var/log/mongodb/mongod.log
noauth: "true"
nohints: "false"
nohttpinterface: "false"
nojournal: "true"
noprealloc: "false"
noscripting: "false"
notablescan: "false"
objcheck: "false"
port: 27017
quota: "false"
# replSet: "" # Set for enable replication
verbose: "true"
vvvv: "true"
mongodb_conf_auth: "false"
mongodb_conf_bind_ip: 127.0.0.1
mongodb_conf_cpu: "true"
mongodb_conf_dbpath: /var/lib/mongodb/
mongodb_conf_logappend: "true"
mongodb_conf_logpath: /var/log/mongodb/mongod.log
mongodb_conf_noauth: "true"
mongodb_conf_nohints: "false"
mongodb_conf_nohttpinterface: "false"
mongodb_conf_nojournal: "true"
mongodb_conf_noprealloc: "false"
mongodb_conf_noscripting: "false"
mongodb_conf_notablescan: "false"
mongodb_conf_objcheck: "false"
mongodb_conf_port: 27017
mongodb_conf_quota: "false"
mongodb_conf_verbose: "true"
mongodb_conf_vvvv: "true"
# Log rotation

View File

@ -2,8 +2,17 @@
- name: Configure mongodb
template: src=mongod.conf.j2 dest=/etc/mongod.conf owner=root group=root mode=0644
notify: mongodb reload
notify: mongodb restart
- name: Configure log rotation
template: src=logrotate.conf.j2 dest=/etc/logrotate.d/mongodb.conf
when: mongodb_logrotate
- name: Create mongodb user
user: name=mongodb group=mongodb
- name: Configure database directory
file: state=directory path={{ mongodb_conf_dbpath }} owner=mongodb group=mongodb mode=0755
- name: Configure logs
file: state=file path={{ mongodb_conf_logpath }} owner=mongodb group=mongodb mode=0644

View File

@ -1,7 +1,7 @@
# This file was generated by Ansible for {{ ansible_fqdn }}
# Do NOT modify this file by hand!
{{ mongodb_conf.logpath }} {
{{ mongodb_conf_logpath }} {
{% for option in mongodb_logrotate_options %}
{{ option }}
{% endfor %}

View File

@ -1,5 +1,20 @@
# {{ ansible_managed }}
{% for k, v in mongodb_conf.iteritems()|sort %}
{{ k }} = {{ v }}
{% endfor %}
auth = {{ mongodb_conf_auth }}
bind_ip = {{ mongodb_conf_bind_ip }}
cpu = {{ mongodb_conf_cpu }}
dbpath = {{ mongodb_conf_dbpath }}
logappend = {{ mongodb_conf_logappend }}
logpath = {{ mongodb_conf_logpath }}
noauth = {{ mongodb_conf_noauth }}
nohints = {{ mongodb_conf_nohints }}
nohttpinterface = {{ mongodb_conf_nohttpinterface }}
nojournal = {{ mongodb_conf_nojournal }}
noprealloc = {{ mongodb_conf_noprealloc }}
noscripting = {{ mongodb_conf_noscripting }}
notablescan = {{ mongodb_conf_notablescan }}
objcheck = {{ mongodb_conf_objcheck }}
port = {{ mongodb_conf_port }}
quota = {{ mongodb_conf_quota }}
verbose = {{ mongodb_conf_verbose }}
vvvv = {{ mongodb_conf_vvvv }}