Select Git revision
-
nimrod authored
# Conflicts: # README.rst # defaults/main.yml # handlers/main.yml # molecule.yml # tasks/main.yml # tests/playbook.yml # vars/main.yml
nimrod authored# Conflicts: # README.rst # defaults/main.yml # handlers/main.yml # molecule.yml # tasks/main.yml # tests/playbook.yml # vars/main.yml
main.yml 2.06 KiB
---
# tasks file for ansible-role-mongod2.6
- assert:
that:
- ansible_os_family == 'Debian'
- ansible_distribution_release == 'trusty'
- mongod_config is defined
- name: Add APT repository key
apt_key:
keyserver: hkp://keyserver.ubuntu.com:80
id: 7F0CEB10
- name: Add APT repository
apt_repository:
repo: deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
state: present
update_cache: yes
- name: APT install
with_items:
- mongodb-org-server
- mongodb-org-shell
- mongodb-org-tools
- python-pymongo
apt:
name: '{{ item }}'
state: present
update_cache: yes
cache_valid_time: 3600
- name: Enable service
service:
name: mongod
enabled: yes
- name: Set mail alias
when: mongod_mail_alias is defined
lineinfile:
dest: /etc/aliases
regexp: mongodb
create: yes
line: 'mongod: {{ mongod_mail_alias }}'
- name: Create dbpath
when: mongod_config.dbpath is defined
file:
dest: '{{ mongod_config.dbpath }}'
owner: mongodb
group: mongodb
state: directory
mode: 0o0750
- name: Create key file
when: mongod_keyFile is defined
template:
dest: /etc/mongod.key
src: mongod.key
owner: mongodb
group: mongodb
mode: 0o0400
- name: Configure
with_dict: '{{ mongod_config }}'
ini_file:
dest: /etc/mongod.conf
option: '{{ item.key }}'
value: '{{ item.value }}'
state: present