master
Amir Hossein Moghiseh 2021-06-23 21:47:44 +04:30
commit 439b563417
6 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,10 @@
---
- name: start and enable glusterfs
hosts: server
become: yes
tasks:
- name: ensure gluster-server started and enabled
ansible.builtin.service:
name: glusterd
state: started
enabled: yes

View File

@ -0,0 +1,9 @@
---
- name: install glusterfs
hosts: server
become: yes
tasks:
- name: ensure gluster-server installed
apt:
name: glusterfs-server
state: latest

View File

@ -0,0 +1,11 @@
---
- name: create directory volume for gluster
hosts: server
become: yes
tasks:
- name: create directory
ansible.builtin.file:
path: /gluster/volume
state: directory

View File

@ -0,0 +1,19 @@
---
- name: make gluster volume persistance
hosts: server
become: yes
tasks:
- name: copy to mnt
ansible.builtin.shell:
cmd: echo 'localhost:/vol /mnt glusterfs defaults,_netdev,backupvolfile-server=localhost 0 0' >> /etc/fstab
- name: mount glusterfs to mnt
ansible.builtin.shell:
cmd: mount.glusterfs localhost:/vol /mnt
- name: change ownership and group
file:
path: /mnt
owner: root
group: docker
recurse: yes

View File

@ -0,0 +1,9 @@
127.0.0.1 localhost
87.107.132.78 worker1
87.107.132.77 master
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

View File

@ -0,0 +1,12 @@
---
- name: set ip and hosts to hosts file
hosts: server
become: yes
tasks:
- name: ensure ip and hosts setted
copy:
src: hosts
dest: /etc/hosts
owner: root
group: root
mode: u=rw,g=r,o=r