2014-06-04 15:03:58 +00:00
|
|
|
---
|
|
|
|
|
2015-01-07 11:31:53 +00:00
|
|
|
- include_vars: "{{ansible_distribution}}.yml"
|
|
|
|
|
2015-03-04 10:05:08 +00:00
|
|
|
- name: Check if running on systemd
|
|
|
|
command: cat /proc/1/cmdline
|
2015-02-25 07:57:36 +00:00
|
|
|
register: systemd
|
|
|
|
|
|
|
|
- name: Add systemd configuration if present
|
|
|
|
copy: src=mongodb.service dest=/lib/systemd/system/mongodb.service owner=root group=root mode=0640
|
2015-03-04 10:05:08 +00:00
|
|
|
when: "'systemd' in systemd.stdout"
|
2015-02-25 07:57:36 +00:00
|
|
|
|
|
|
|
- name: Add symlink for systemd
|
|
|
|
file: src=/lib/systemd/system/mongodb.service dest=/etc/systemd/system/multi-user.target.wants/mongodb.service state=link
|
2015-03-04 10:05:08 +00:00
|
|
|
when: "'systemd' in systemd.stdout"
|
2015-02-25 07:57:36 +00:00
|
|
|
notify: reload systemd
|
|
|
|
|
|
|
|
- meta: flush_handlers
|
2015-03-04 10:05:08 +00:00
|
|
|
when: "'systemd' in systemd.stdout"
|
2015-02-25 07:57:36 +00:00
|
|
|
|
2014-06-04 15:03:58 +00:00
|
|
|
- name: Add APT key
|
|
|
|
apt_key: url=http://docs.mongodb.org/10gen-gpg-key.asc id=7F0CEB10
|
2015-01-23 09:43:11 +00:00
|
|
|
when: '"mongodb-org" in mongodb_package'
|
2014-06-04 15:03:58 +00:00
|
|
|
|
2015-01-07 11:31:53 +00:00
|
|
|
- name: Add APT repository
|
|
|
|
apt_repository: repo="{{mongodb_repository}}" update_cache=yes
|
2015-01-23 09:43:11 +00:00
|
|
|
when: '"mongodb-org" in mongodb_package'
|
2015-01-05 13:37:28 +00:00
|
|
|
|
2015-01-07 11:31:53 +00:00
|
|
|
- name: Install MongoDB package
|
|
|
|
apt: pkg={{mongodb_package}} state=present
|
2015-02-25 07:57:36 +00:00
|
|
|
|
2015-02-26 14:11:22 +00:00
|
|
|
- name: reload systemd
|
|
|
|
shell: systemctl daemon-reload
|
|
|
|
changed_when: false
|
2015-03-04 10:05:08 +00:00
|
|
|
when: "'systemd' in systemd.stdout"
|
2015-01-05 13:37:28 +00:00
|
|
|
|
|
|
|
- name: Install additional packages
|
2014-06-04 15:03:58 +00:00
|
|
|
apt: pkg={{item}}
|
2015-01-05 13:37:28 +00:00
|
|
|
with_items: mongodb_additional_packages
|