40 lines
1.1 KiB
YAML
40 lines
1.1 KiB
YAML
---
|
|
|
|
- include_vars: "{{ansible_distribution}}.yml"
|
|
|
|
- name: Check if running on systemd
|
|
command: cat /proc/1/cmdline
|
|
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' in systemd.stdout"
|
|
|
|
- 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' in systemd.stdout"
|
|
notify: reload systemd
|
|
|
|
- meta: flush_handlers
|
|
when: "'systemd' in systemd.stdout"
|
|
|
|
- name: Add APT key
|
|
apt_key: url=http://docs.mongodb.org/10gen-gpg-key.asc id=7F0CEB10
|
|
when: '"mongodb-org" in mongodb_package'
|
|
|
|
- name: Add APT repository
|
|
apt_repository: repo="{{mongodb_repository}}" update_cache=yes
|
|
when: '"mongodb-org" in mongodb_package'
|
|
|
|
- name: Install MongoDB package
|
|
apt: pkg={{mongodb_package}} state=present
|
|
|
|
- name: reload systemd
|
|
shell: systemctl daemon-reload
|
|
changed_when: false
|
|
when: "'systemd' in systemd.stdout"
|
|
|
|
- name: Install additional packages
|
|
apt: pkg={{item}}
|
|
with_items: mongodb_additional_packages
|