Merge pull request #70 from davidcaste/fix-again-systemd
Fix (again) Systemd support
This commit is contained in:
commit
2dec49074d
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
- name: reload systemd
|
- name: reload systemd
|
||||||
shell: systemctl daemon-reload
|
shell: systemctl daemon-reload
|
||||||
when: systemd.stat.exists == true and mongodb_manage_service
|
when: mongodb_is_systemd and mongodb_manage_service
|
||||||
|
|
||||||
- name: restart sysfsutils
|
- name: restart sysfsutils
|
||||||
service: name=sysfsutils state=restarted
|
service: name=sysfsutils state=restarted
|
||||||
|
|
|
@ -8,35 +8,39 @@
|
||||||
changed_when: false
|
changed_when: false
|
||||||
always_run: yes # side-effect free, so it can be run in check-mode as well
|
always_run: yes # side-effect free, so it can be run in check-mode as well
|
||||||
|
|
||||||
|
- name: Establish some role-related facts
|
||||||
|
set_fact:
|
||||||
|
mongodb_is_systemd: "{{ sbin_init.stat.islnk is defined and sbin_init.stat.islnk }}"
|
||||||
|
mongodb_major_version: "{{ mongodb_version[0:3] }}"
|
||||||
|
|
||||||
- name: Add systemd configuration if present
|
- name: Add systemd configuration if present
|
||||||
copy: src=mongodb.service dest=/lib/systemd/system/mongodb.service owner=root group=root mode=0640
|
copy: src=mongodb.service dest=/lib/systemd/system/mongodb.service owner=root group=root mode=0640
|
||||||
when: sbin_init.stat.islnk is defined and sbin_init.stat.islnk
|
when: mongodb_is_systemd
|
||||||
|
|
||||||
- name: Add symlink for systemd
|
- name: Add symlink for systemd
|
||||||
file: src=/lib/systemd/system/mongodb.service dest=/etc/systemd/system/multi-user.target.wants/mongodb.service state=link
|
file: src=/lib/systemd/system/mongodb.service dest=/etc/systemd/system/multi-user.target.wants/mongodb.service state=link
|
||||||
when: sbin_init.stat.islnk is defined and sbin_init.stat.islnk
|
when: mongodb_is_systemd
|
||||||
notify: reload systemd
|
notify: reload systemd
|
||||||
|
|
||||||
- meta: flush_handlers
|
- meta: flush_handlers
|
||||||
when: sbin_init.stat.islnk is defined and sbin_init.stat.islnk
|
when: mongodb_is_systemd
|
||||||
|
|
||||||
- name: Add APT key
|
- name: Add APT key
|
||||||
apt_key:
|
apt_key:
|
||||||
keyserver: "{{mongodb_apt_keyserver}}"
|
keyserver: "{{mongodb_apt_keyserver}}"
|
||||||
id: "{{mongodb_apt_key_id}}"
|
id: "{{mongodb_apt_key_id}}"
|
||||||
when: mongodb_package == 'mongodb-org'
|
when: mongodb_package == 'mongodb-org'
|
||||||
|
|
||||||
- name: Fail when used wrong mongodb_version variable
|
- name: Fail when used wrong mongodb_version variable
|
||||||
fail:
|
fail:
|
||||||
msg: "mongodb_version variable should be '2.6', '3.0' or '3.2'"
|
msg: "mongodb_version variable should be '2.6', '3.0' or '3.2'"
|
||||||
when: (mongodb_package == 'mongodb-org' and
|
when: (mongodb_package == 'mongodb-org' and
|
||||||
(mongodb_version is not defined
|
(mongodb_version is not defined
|
||||||
or mongodb_repository[item] is not defined))
|
or mongodb_repository[mongodb_major_version] is not defined))
|
||||||
with_items: "{{ mongodb_version[0:3] }}"
|
|
||||||
|
|
||||||
- name: Add APT repository
|
- name: Add APT repository
|
||||||
apt_repository: repo="{{ mongodb_repository[item] }}" update_cache=yes
|
apt_repository: repo="{{ mongodb_repository[item] }}" update_cache=yes
|
||||||
with_items: "{{ mongodb_version[0:3] }}"
|
with_items: "{{ mongodb_major_version }}"
|
||||||
when: mongodb_package == 'mongodb-org'
|
when: mongodb_package == 'mongodb-org'
|
||||||
|
|
||||||
- name: Install MongoDB package
|
- name: Install MongoDB package
|
||||||
|
@ -48,7 +52,7 @@
|
||||||
- name: reload systemd
|
- name: reload systemd
|
||||||
shell: systemctl daemon-reload
|
shell: systemctl daemon-reload
|
||||||
changed_when: false
|
changed_when: false
|
||||||
when: sbin_init.stat.islnk is defined and sbin_init.stat.islnk
|
when: mongodb_is_systemd
|
||||||
|
|
||||||
- name: Install PyMongo package
|
- name: Install PyMongo package
|
||||||
apt: pkg=python-pymongo state=latest
|
apt: pkg=python-pymongo state=latest
|
||||||
|
|
|
@ -19,7 +19,7 @@ replication:
|
||||||
secondaryIndexPrefetch: {{ mongodb_replication_replindexprefetch }}
|
secondaryIndexPrefetch: {{ mongodb_replication_replindexprefetch }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
security:
|
security:
|
||||||
authorization: {{ mongodb_security_authorization }}
|
authorization: {{ mongodb_security_authorization }}
|
||||||
{% if mongodb_replication_replset and mongodb_security_authorization == 'enabled' -%}
|
{% if mongodb_replication_replset and mongodb_security_authorization == 'enabled' -%}
|
||||||
|
@ -28,7 +28,7 @@ security:
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
dbPath: {{ mongodb_storage_dbpath }}
|
dbPath: {{ mongodb_storage_dbpath }}
|
||||||
{% if mongodb_version[0:3]|float >= 3.0 -%}
|
{% if mongodb_major_version|float >= 3.0 -%}
|
||||||
engine: {{ mongodb_storage_engine }}
|
engine: {{ mongodb_storage_engine }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
journal:
|
journal:
|
||||||
|
@ -40,7 +40,7 @@ storage:
|
||||||
maxFilesPerDB: {{ mongodb_storage_quota_maxfiles }}
|
maxFilesPerDB: {{ mongodb_storage_quota_maxfiles }}
|
||||||
smallFiles: {{ mongodb_storage_smallfiles | to_nice_json }}
|
smallFiles: {{ mongodb_storage_smallfiles | to_nice_json }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if mongodb_version[0:3] == '2.6' -%}
|
{% if mongodb_major_version == '2.6' -%}
|
||||||
quota:
|
quota:
|
||||||
enforced: {{ mongodb_storage_quota_enforced | to_nice_json }}
|
enforced: {{ mongodb_storage_quota_enforced | to_nice_json }}
|
||||||
maxFilesPerDB: {{ mongodb_storage_quota_maxfiles }}
|
maxFilesPerDB: {{ mongodb_storage_quota_maxfiles }}
|
||||||
|
@ -52,4 +52,3 @@ systemLog:
|
||||||
destination: {{ mongodb_systemlog_destination }}
|
destination: {{ mongodb_systemlog_destination }}
|
||||||
logAppend: {{ mongodb_systemlog_logappend | to_nice_json }}
|
logAppend: {{ mongodb_systemlog_logappend | to_nice_json }}
|
||||||
path: {{ mongodb_systemlog_path }}
|
path: {{ mongodb_systemlog_path }}
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,13 @@ net:
|
||||||
|
|
||||||
processManagement:
|
processManagement:
|
||||||
fork: {{ mongodb_processmanagement_fork | to_nice_json }}
|
fork: {{ mongodb_processmanagement_fork | to_nice_json }}
|
||||||
|
|
||||||
security:
|
security:
|
||||||
authorization: 'disabled'
|
authorization: 'disabled'
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
dbPath: {{ mongodb_storage_dbpath }}
|
dbPath: {{ mongodb_storage_dbpath }}
|
||||||
{% if mongodb_version[0:3]|float >= 3.0 -%}
|
{% if mongodb_major_version|float >= 3.0 -%}
|
||||||
engine: {{ mongodb_storage_engine }}
|
engine: {{ mongodb_storage_engine }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
journal:
|
journal:
|
||||||
|
@ -28,7 +28,7 @@ storage:
|
||||||
maxFilesPerDB: {{ mongodb_storage_quota_maxfiles }}
|
maxFilesPerDB: {{ mongodb_storage_quota_maxfiles }}
|
||||||
smallFiles: {{ mongodb_storage_smallfiles | to_nice_json }}
|
smallFiles: {{ mongodb_storage_smallfiles | to_nice_json }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if mongodb_version[0:3] == '2.6' -%}
|
{% if mongodb_major_version == '2.6' -%}
|
||||||
quota:
|
quota:
|
||||||
enforced: {{ mongodb_storage_quota_enforced | to_nice_json }}
|
enforced: {{ mongodb_storage_quota_enforced | to_nice_json }}
|
||||||
maxFilesPerDB: {{ mongodb_storage_quota_maxfiles }}
|
maxFilesPerDB: {{ mongodb_storage_quota_maxfiles }}
|
||||||
|
|
Loading…
Reference in New Issue