2014-06-04 19:03:58 +04:00
|
|
|
---
|
|
|
|
|
2015-01-07 14:31:53 +03:00
|
|
|
- include_vars: "{{ansible_distribution}}.yml"
|
|
|
|
|
2015-03-04 11:05:08 +01:00
|
|
|
- name: Check if running on systemd
|
|
|
|
command: cat /proc/1/cmdline
|
2015-02-25 08:57:36 +01:00
|
|
|
register: systemd
|
2015-06-16 14:19:58 +06:00
|
|
|
changed_when: false
|
2015-02-25 08:57:36 +01:00
|
|
|
|
|
|
|
- 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 11:05:08 +01:00
|
|
|
when: "'systemd' in systemd.stdout"
|
2015-02-25 08:57:36 +01: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 11:05:08 +01:00
|
|
|
when: "'systemd' in systemd.stdout"
|
2015-02-25 08:57:36 +01:00
|
|
|
notify: reload systemd
|
|
|
|
|
|
|
|
- meta: flush_handlers
|
2015-03-04 11:05:08 +01:00
|
|
|
when: "'systemd' in systemd.stdout"
|
2015-02-25 08:57:36 +01:00
|
|
|
|
2014-06-04 19:03:58 +04:00
|
|
|
- name: Add APT key
|
2015-08-14 13:25:37 -07:00
|
|
|
apt_key: url="{{mongodb_apt_key_url}}" id="{{mongodb_apt_key_id}}"
|
2014-06-04 19:03:58 +04:00
|
|
|
|
2015-01-07 14:31:53 +03:00
|
|
|
- name: Add APT repository
|
|
|
|
apt_repository: repo="{{mongodb_repository}}" update_cache=yes
|
2015-01-05 14:37:28 +01:00
|
|
|
|
2015-07-25 11:46:34 +02:00
|
|
|
- name: Endure /data directory
|
|
|
|
file: path=/data/db state=directory owner=mongodb recurse=yes
|
|
|
|
|
2015-01-07 14:31:53 +03:00
|
|
|
- name: Install MongoDB package
|
2015-06-26 18:56:32 +02:00
|
|
|
apt: name={{item}} state=present
|
|
|
|
with_items:
|
|
|
|
- "{{mongodb_package}}"
|
|
|
|
- numactl
|
2015-02-25 08:57:36 +01:00
|
|
|
|
2015-02-26 15:11:22 +01:00
|
|
|
- name: reload systemd
|
|
|
|
shell: systemctl daemon-reload
|
|
|
|
changed_when: false
|
2015-03-04 11:05:08 +01:00
|
|
|
when: "'systemd' in systemd.stdout"
|
2015-01-05 14:37:28 +01:00
|
|
|
|
2015-04-06 19:38:52 +03:00
|
|
|
- name: Install PyMongo package
|
|
|
|
apt: pkg=python-pymongo state=latest
|
|
|
|
when: not mongodb_pymongo_from_pip
|
|
|
|
|
2015-04-06 19:51:47 +03:00
|
|
|
- name: Install PIP
|
2015-04-06 19:38:52 +03:00
|
|
|
apt: pkg={{ item }}
|
|
|
|
with_items:
|
|
|
|
- python-dev
|
|
|
|
- python-pip
|
|
|
|
when: mongodb_pymongo_from_pip
|
|
|
|
|
|
|
|
- name: Install PyMongo from PIP
|
|
|
|
pip: name=pymongo state=latest
|
|
|
|
when: mongodb_pymongo_from_pip
|