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:
parent
28b7816fdf
commit
609d600386
1 changed files with 45 additions and 39 deletions
|
@ -1,6 +1,7 @@
|
||||||
- name: Install mongodb required packages
|
- name: Install MongoDB required packages
|
||||||
package: name={{ item }}
|
package:
|
||||||
state=present
|
name: "{{ item }}"
|
||||||
|
state: present
|
||||||
with_items:
|
with_items:
|
||||||
- mongodb-server
|
- mongodb-server
|
||||||
- mongodb
|
- mongodb
|
||||||
|
@ -8,50 +9,55 @@
|
||||||
tags:
|
tags:
|
||||||
- download
|
- download
|
||||||
|
|
||||||
- name: create the data directory for mongodb
|
- name: Create the data directory for MongoDB
|
||||||
file: state=directory
|
file:
|
||||||
path={{ item.path }}
|
state: directory
|
||||||
owner=mongodb
|
path: "{{ item.path }}"
|
||||||
|
owner: mongodb
|
||||||
with_items:
|
with_items:
|
||||||
- { path: '/var/run/mongodb' }
|
- { path: '/var/run/mongodb' }
|
||||||
- { path: '/library/dbdata/mongodb' }
|
- { path: '/library/dbdata/mongodb' }
|
||||||
- { path: '/var/log/mongodb' }
|
- { path: '/var/log/mongodb' }
|
||||||
|
|
||||||
- name: Move required files
|
- name: Position /etc/mongod.conf and mongodb.service
|
||||||
template: src={{ item.src }}
|
template:
|
||||||
dest={{ item.dest }}
|
src: "{{ item.src }}"
|
||||||
owner=root
|
dest: "{{ item.dest }}"
|
||||||
group=root
|
owner: root
|
||||||
mode=0644
|
group: root
|
||||||
|
mode: 0644
|
||||||
with_items:
|
with_items:
|
||||||
- { src: 'mongodb.service' , dest: '/etc/systemd/system/' }
|
- { src: 'mongodb.service' , dest: '/etc/systemd/system/' }
|
||||||
- { src: 'mongod.conf' , dest: '/etc/mongod.conf'}
|
- { src: 'mongod.conf' , dest: '/etc/mongod.conf'}
|
||||||
|
|
||||||
- name: enable services
|
- name: Restart service if enabled
|
||||||
service: name={{ item.name }}
|
service:
|
||||||
enabled=yes
|
name: "{{ item.name }}"
|
||||||
state=restarted
|
enabled: yes
|
||||||
|
state: restarted
|
||||||
with_items:
|
with_items:
|
||||||
- { name: mongodb }
|
- { name: mongodb }
|
||||||
when: mongodb_enabled
|
when: mongodb_enabled
|
||||||
|
|
||||||
- name: disable services
|
- name: Stop service if not enabled
|
||||||
service: name={{ item.name }}
|
service:
|
||||||
enabled=no
|
name: "{{ item.name }}"
|
||||||
state=stopped
|
enabled: no
|
||||||
|
state: stopped
|
||||||
with_items:
|
with_items:
|
||||||
- { name: mongodb }
|
- { name: mongodb }
|
||||||
when: not mongodb_enabled
|
when: not mongodb_enabled
|
||||||
|
|
||||||
- name: add mongodb to service list
|
- name: Add 'mongodb' to list of services at /etc/iiab/iiab.ini
|
||||||
ini_file: dest="{{ service_filelist }}"
|
ini_file:
|
||||||
section=mongodb
|
dest: "{{ service_filelist }}"
|
||||||
option="{{ item.option }}"
|
section: mongodb
|
||||||
value="{{ item.value }}"
|
option: "{{ item.option }}"
|
||||||
|
value: "{{ item.value }}"
|
||||||
with_items:
|
with_items:
|
||||||
- option: name
|
- option: name
|
||||||
value: MongoDB
|
value: MongoDB
|
||||||
- option: description
|
- option: description
|
||||||
value: '"MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling."'
|
value: '"MongoDB is an open-source document database that provides high performance, high availability, and automatic scaling."'
|
||||||
- option: enabled
|
- option: enabled
|
||||||
value: "{{ mongodb_enabled }}"
|
value: "{{ mongodb_enabled }}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue