Merge pull request #1 from deimosfr/master
fixing service fail with systemd
This commit is contained in:
commit
fc08138189
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
Description=An object/document-oriented database
|
||||||
|
Documentation=man:mongod(1)
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=mongodb
|
||||||
|
ExecStart=/usr/bin/mongod --config /etc/mongodb.conf
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -8,3 +8,6 @@
|
||||||
|
|
||||||
- name: mongodb-mms-automation-agent restart
|
- name: mongodb-mms-automation-agent restart
|
||||||
service: name=mongodb-mms-automation-agent state=restarted
|
service: name=mongodb-mms-automation-agent state=restarted
|
||||||
|
|
||||||
|
- name: reload systemd
|
||||||
|
shell: systemctl daemon-reload
|
||||||
|
|
|
@ -13,9 +13,18 @@
|
||||||
template: src=logrotate.conf.j2 dest=/etc/logrotate.d/mongodb.conf
|
template: src=logrotate.conf.j2 dest=/etc/logrotate.d/mongodb.conf
|
||||||
when: mongodb_logrotate
|
when: mongodb_logrotate
|
||||||
|
|
||||||
|
#- name: reload systemd
|
||||||
|
# shell: systemctl daemon-reload
|
||||||
|
# when: systemd.stat.exists == true
|
||||||
|
# changed_when: false
|
||||||
|
|
||||||
- name: ensure mongodb started and enabled
|
- name: ensure mongodb started and enabled
|
||||||
service: name={{ mongodb_daemon_name }} state=started enabled=yes
|
service: name={{ mongodb_daemon_name }} state=started enabled=yes
|
||||||
|
|
||||||
|
- name: wait MongoDB port is listening
|
||||||
|
wait_for: host="{{ mongodb_conf_bind_ip }}"port="{{ mongodb_conf_port }}" delay=5 state=started
|
||||||
|
when: systemd.stat.exists == true
|
||||||
|
|
||||||
- include: auth_initialization.yml
|
- include: auth_initialization.yml
|
||||||
when: mongodb_conf_auth
|
when: mongodb_conf_auth
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,22 @@
|
||||||
|
|
||||||
- include_vars: "{{ansible_distribution}}.yml"
|
- include_vars: "{{ansible_distribution}}.yml"
|
||||||
|
|
||||||
|
- name: Check if systemd is present
|
||||||
|
stat: path=/lib/systemd/system/
|
||||||
|
register: systemd
|
||||||
|
|
||||||
|
- name: Add systemd configuration if present
|
||||||
|
copy: src=mongodb.service dest=/lib/systemd/system/mongodb.service owner=root group=root mode=0640
|
||||||
|
when: systemd.stat.exists == true
|
||||||
|
|
||||||
|
- name: Add symlink for systemd
|
||||||
|
file: src=/lib/systemd/system/mongodb.service dest=/etc/systemd/system/multi-user.target.wants/mongodb.service state=link
|
||||||
|
when: systemd.stat.exists == true
|
||||||
|
notify: reload systemd
|
||||||
|
|
||||||
|
- meta: flush_handlers
|
||||||
|
when: systemd.stat.exists == true
|
||||||
|
|
||||||
- name: Add APT key
|
- name: Add APT key
|
||||||
apt_key: url=http://docs.mongodb.org/10gen-gpg-key.asc id=7F0CEB10
|
apt_key: url=http://docs.mongodb.org/10gen-gpg-key.asc id=7F0CEB10
|
||||||
when: '"mongodb-org" in mongodb_package'
|
when: '"mongodb-org" in mongodb_package'
|
||||||
|
@ -12,6 +28,9 @@
|
||||||
|
|
||||||
- name: Install MongoDB package
|
- name: Install MongoDB package
|
||||||
apt: pkg={{mongodb_package}} state=present
|
apt: pkg={{mongodb_package}} state=present
|
||||||
|
notify: reload systemd
|
||||||
|
|
||||||
|
- meta: flush_handlers
|
||||||
|
|
||||||
- name: Install additional packages
|
- name: Install additional packages
|
||||||
apt: pkg={{item}}
|
apt: pkg={{item}}
|
||||||
|
|
Loading…
Reference in New Issue