1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Update main.yml

This commit is contained in:
A Holt 2018-07-11 20:49:03 -04:00 committed by GitHub
parent 28b7816fdf
commit 609d600386
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,7 @@
- name: Install mongodb required packages
package: name={{ item }}
state=present
- name: Install MongoDB required packages
package:
name: "{{ item }}"
state: present
with_items:
- mongodb-server
- mongodb
@ -8,50 +9,55 @@
tags:
- download
- name: create the data directory for mongodb
file: state=directory
path={{ item.path }}
owner=mongodb
- name: Create the data directory for MongoDB
file:
state: directory
path: "{{ item.path }}"
owner: mongodb
with_items:
- { path: '/var/run/mongodb' }
- { path: '/library/dbdata/mongodb' }
- { path: '/var/log/mongodb' }
- { path: '/var/run/mongodb' }
- { path: '/library/dbdata/mongodb' }
- { path: '/var/log/mongodb' }
- name: Move required files
template: src={{ item.src }}
dest={{ item.dest }}
owner=root
group=root
mode=0644
- name: Position /etc/mongod.conf and mongodb.service
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: 0644
with_items:
- { src: 'mongodb.service' , dest: '/etc/systemd/system/' }
- { src: 'mongod.conf' , dest: '/etc/mongod.conf'}
- { src: 'mongodb.service' , dest: '/etc/systemd/system/' }
- { src: 'mongod.conf' , dest: '/etc/mongod.conf'}
- name: enable services
service: name={{ item.name }}
enabled=yes
state=restarted
- name: Restart service if enabled
service:
name: "{{ item.name }}"
enabled: yes
state: restarted
with_items:
- { name: mongodb }
- { name: mongodb }
when: mongodb_enabled
- name: disable services
service: name={{ item.name }}
enabled=no
state=stopped
- name: Stop service if not enabled
service:
name: "{{ item.name }}"
enabled: no
state: stopped
with_items:
- { name: mongodb }
- { name: mongodb }
when: not mongodb_enabled
- name: add mongodb to service list
ini_file: dest="{{ service_filelist }}"
section=mongodb
option="{{ item.option }}"
value="{{ item.value }}"
- name: Add 'mongodb' to list of services at /etc/iiab/iiab.ini
ini_file:
dest: "{{ service_filelist }}"
section: mongodb
option: "{{ item.option }}"
value: "{{ item.value }}"
with_items:
- option: name
value: MongoDB
- option: description
value: '"MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling."'
- option: enabled
value: "{{ mongodb_enabled }}"
- option: name
value: MongoDB
- option: description
value: '"MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling."'
- option: enabled
value: "{{ mongodb_enabled }}"