68 lines
1.4 KiB
YAML
68 lines
1.4 KiB
YAML
---
|
|
- name: Install gluster
|
|
ansible.builtin.apt:
|
|
update_cache: true
|
|
cache_valid_time: 3600
|
|
name:
|
|
- glusterfs-server
|
|
become: true
|
|
|
|
- name: start service
|
|
ansible.builtin.service:
|
|
name: glusterd
|
|
state: started
|
|
enabled: true
|
|
become: true
|
|
|
|
- name: Create brick dir
|
|
ansible.builtin.file:
|
|
path: "{{ gluster.brick_dir }}"
|
|
state: directory
|
|
become: true
|
|
|
|
- name: Create volume
|
|
gluster.gluster.gluster_volume:
|
|
state: present
|
|
name: "{{ gluster.vol_name }}"
|
|
bricks: "{{ gluster.brick_dir }}"
|
|
cluster: "{{ gluster.cluster }}"
|
|
force: true
|
|
run_once: true
|
|
become: true
|
|
|
|
- name: Start volume
|
|
gluster.gluster.gluster_volume:
|
|
state: started
|
|
name: "{{ gluster.vol_name }}"
|
|
run_once: true
|
|
become: true
|
|
|
|
- name: Mount volume
|
|
mount:
|
|
name: "{{ gluster.mount_dir }}"
|
|
src: "{{ ansible_ens10.ipv4.address }}:/{{ gluster.vol_name }}"
|
|
fstype: glusterfs
|
|
opts: "defaults,_netdev,noauto,x-systemd.automount"
|
|
state: mounted
|
|
become: true
|
|
|
|
- name: Add group
|
|
ansible.builtin.group:
|
|
name: "{{ gluster.dir_owner }}"
|
|
become: true
|
|
|
|
- name: Add user
|
|
ansible.builtin.user:
|
|
name: "{{ gluster.dir_owner }}"
|
|
group: "{{ gluster.dir_group }}"
|
|
become: true
|
|
|
|
- name: Change ownership
|
|
file:
|
|
path: "{{ gluster.mount_dir }}"
|
|
owner: "{{ gluster.dir_owner }}"
|
|
group: "{{ gluster.dir_group }}"
|
|
state: directory
|
|
mode: "0755"
|
|
become: true
|