53 lines
1.1 KiB
YAML
53 lines
1.1 KiB
YAML
|
---
|
||
|
- 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_all_ipv4_addresses[1] }}:/{{ gluster.vol_name }}"
|
||
|
fstype: glusterfs
|
||
|
opts: "defaults,_netdev"
|
||
|
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
|