68 lines
1.4 KiB
YAML
Raw Normal View History

2023-09-05 23:05:22 +02:00
---
2023-09-14 21:57:26 +02:00
- 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
2023-09-05 23:05:22 +02:00
- 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 }}"
2023-09-14 21:57:26 +02:00
src: "{{ ansible_all_ipv4_addresses[0] }}:/{{ gluster.vol_name }}"
2023-09-05 23:05:22 +02:00
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