Skip to content

Instantly share code, notes, and snippets.

@juffaz
Last active December 28, 2018 11:07
Show Gist options
  • Save juffaz/d82324afa9754f3bd7248ab0ebe7a039 to your computer and use it in GitHub Desktop.
Save juffaz/d82324afa9754f3bd7248ab0ebe7a039 to your computer and use it in GitHub Desktop.
[devops@centreon01 ansible]$ sudo ansible-galaxy install geerlingguy.firewall geerlingguy.glusterfs
[devops@centreon01 ansible]$ ansible-playbook deploy-glusterfs-debian-fs.yml -l app -b
[devops@centreon01 ansible]$ cat deploy-glusterfs-debian-fs.yml
---
- hosts: all
remote_user: devops
sudo: yes
vars:
firewall_allowed_tcp_ports:
- 80
- 443
- 22
- 111
- 24007
- 24009
- 24010
- 38465
- 38466
- 49144
- 49145
- 49146
- 49147
- 49152
- 49153
gluster_mount_dir: /var/hostfs
gluster_brick_dir: /srv/gluster/brickfs
gluster_brick_name: hostfs
roles:
- geerlingguy.firewall
- geerlingguy.glusterfs
tasks:
- name: Ensure Gluster brick and mount directories exist.
file: "path={{ item }} state=directory mode=0775"
with_items:
- "{{ gluster_brick_dir }}"
- "{{ gluster_mount_dir }}"
- name: Configure Gluster volume.
gluster_volume:
state: present
name: "{{ gluster_brick_name }}"
brick: "{{ gluster_brick_dir }}"
replicas: 2
cluster: "{{ groups.chostapp | join(',') }}"
host: "{{ inventory_hostname }}"
force: yes
run_once: true
- name: Ensure Gluster volume is mounted.
mount:
name: "{{ gluster_mount_dir }}"
src: "{{ inventory_hostname }}:/{{ gluster_brick_name }}"
fstype: glusterfs
opts: "defaults,_netdev"
state: mounted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment