Skip to content

Commit 412b08e

Browse files
committed
Thứ năm, 03 Tháng 12 năm 2020 21:01:16 +07
1 parent ee6c30c commit 412b08e

File tree

6 files changed

+77
-0
lines changed

6 files changed

+77
-0
lines changed

Ansible/Ansible_roles/hosts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[test_servers]
2+
192.168.50.190

Ansible/Ansible_roles/readme.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
My Personal Ansible Roles
2+
===============
3+
4+
# How to use
5+
6+
1. List your hosts in **hosts** file
7+
2. Edit roles which you want to install in target.yml
8+
3. Run `ansible-playbook -i hosts targets.yml`
9+
10+
## 1/ Check your syntax before running
11+
12+
```bash
13+
ansible-playbook --syntax-check targets.yml
14+
```
15+
16+
## 2/ Dry-run mode
17+
18+
```bash
19+
ansible-playbook --check targets.yml
20+
```
21+
22+
## 3/ Run it
23+
24+
```bash
25+
ansible-playbook -i hosts targets.yml
26+
```
27+
28+
# Information
29+
30+
Supported Roles:
31+
32+
- Database
33+
- [x] MongoDB
34+
- ELK Stack
35+
- [x] ElasticSearch
36+
- [ ] LogStack
37+
- [ ] Kibana
38+
- [ ] Filebeat
39+
- [ ] MetricBeat
40+
41+
42+
Suported OS
43+
44+
- [x] Ubuntu
45+
- [ ] Centos
46+
- [ ] Debian

Ansible/Ansible_roles/roles/mongodb/file/mongodb.conf

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
# tasks file for mongoDB setup
3+
4+
- name: Add APT key for mongoDB
5+
apt_key:
6+
url: "https://www.mongodb.org/static/pgp/server-4.4.asc"
7+
state: present
8+
9+
- name: Add apt repository for mongoDB
10+
apt_repository:
11+
repo: deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse
12+
filename: 'mongodb-org-4.4.list'
13+
state: present
14+
15+
- name: Apt update and install mongodb-org package
16+
apt:
17+
name: mongodb-org
18+
update_cache: yes
19+
20+
- name: Start the mongodb service
21+

Ansible/Ansible_roles/target.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- host: test_servers
2+
roles:
3+
- mongodb

Ansible/Readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ sudo yum update
6868
sudo yum install epel-release
6969
sudo yum install ansible
7070
```
71+
- Nếu sử dụng Ubuntu 20:
72+
```
73+
sudo apt update
74+
sudo apt install ansible
75+
```
7176
- Khai báo các host vào file inventory:
7277
```
7378
cat << EOF > /etc/ansible/hosts

0 commit comments

Comments
 (0)