ansible-role-mongodb/tasks/configure.yml

37 lines
1.1 KiB
YAML
Raw Normal View History

2014-06-04 15:03:58 +00:00
---
- name: Create keyFile
copy:
dest: "{{ mongodb_conf_keyFile }}"
content: "{{ mongodb_keyfile_content }}"
owner: "{{ mongodb_user }}"
group: "root"
mode: 0600
when: mongodb_conf_replSet != ''
2014-06-04 15:09:28 +00:00
- name: Configure mongodb
2014-07-30 17:32:46 +00:00
template: src=mongod.conf.j2 dest=/etc/mongod.conf owner=root group=root mode=0644
2014-12-11 19:09:31 +00:00
notify: mongodb restart
register: config_result
- name: mongodb restart
service: name={{ mongodb_daemon_name }} state=restarted
when: config_result|changed
2014-07-10 16:07:35 +00:00
- name: Configure log rotation
template: src=logrotate.conf.j2 dest=/etc/logrotate.d/mongodb.conf
when: mongodb_logrotate
2014-12-11 19:09:31 +00:00
- name: Create mongodb user
2014-12-19 14:39:09 +00:00
user: name={{mongodb_user}} group={{mongodb_user}}
2014-12-11 19:09:31 +00:00
- name: Configure database directory
2014-12-19 14:39:09 +00:00
file: state=directory path={{ mongodb_conf_dbpath }} owner={{mongodb_user}} group={{mongodb_user}} mode=0755
2014-12-11 19:09:31 +00:00
- name: Configure logs
2014-12-19 14:39:09 +00:00
file: state=file path={{ mongodb_conf_logpath }} owner={{mongodb_user}} group={{mongodb_user}} mode=0644
2014-12-26 15:32:50 +00:00
- name: Run mongoshell commands
command: mongo {{ item.key }} --eval "{{ item.value|join('\n') }}"
with_dict: mongodb_shell