aboutsummaryrefslogtreecommitdiff
path: root/os_config/roles/storage
diff options
context:
space:
mode:
authorQuentin <quentin@deuxfleurs.fr>2020-09-12 10:03:48 +0200
committerQuentin <quentin@deuxfleurs.fr>2020-09-12 10:03:48 +0200
commitc4a6cf1534b864d3941c839d4a4dca7e505bd828 (patch)
tree3e866768cf39ae947def5b205f74fddfb435725d /os_config/roles/storage
parent0550647b9348d1e36431400e0832b4340564c658 (diff)
downloadinfrastructure-c4a6cf1534b864d3941c839d4a4dca7e505bd828.tar.gz
infrastructure-c4a6cf1534b864d3941c839d4a4dca7e505bd828.zip
Rebase first step
Diffstat (limited to 'os_config/roles/storage')
-rw-r--r--os_config/roles/storage/handlers/main.yml3
-rw-r--r--os_config/roles/storage/tasks/main.yml72
2 files changed, 75 insertions, 0 deletions
diff --git a/os_config/roles/storage/handlers/main.yml b/os_config/roles/storage/handlers/main.yml
new file mode 100644
index 0000000..a395c93
--- /dev/null
+++ b/os_config/roles/storage/handlers/main.yml
@@ -0,0 +1,3 @@
+---
+- name: umount gluster
+ shell: umount --force --lazy /mnt/glusterfs ; true
diff --git a/os_config/roles/storage/tasks/main.yml b/os_config/roles/storage/tasks/main.yml
new file mode 100644
index 0000000..a1f2d8f
--- /dev/null
+++ b/os_config/roles/storage/tasks/main.yml
@@ -0,0 +1,72 @@
+- name: "Add GlusterFS Repo Key"
+ apt_key:
+ url: https://download.gluster.org/pub/gluster/glusterfs/5/rsa.pub
+ state: present
+
+- name: "Add GlusterFS official repository"
+ apt_repository:
+ repo: "deb [arch=amd64] https://download.gluster.org/pub/gluster/glusterfs/5/LATEST/Debian/buster/amd64/apt buster main"
+ state: present
+ filename: gluster
+
+- name: "Install GlusterFS"
+ apt:
+ name:
+ - glusterfs-server
+ - glusterfs-client
+ state: present
+
+- name: "Ensure Gluster Daemon started and enabled"
+ service:
+ name: glusterd
+ enabled: yes
+ state: started
+
+- name: "Create directory for GlusterFS bricks"
+ file: path=/mnt/storage/glusterfs/brick1 recurse=yes state=directory
+
+- name: "Create GlusterFS volumes"
+ gluster_volume:
+ state: present
+ name: donnees
+ bricks: /mnt/storage/glusterfs/brick1/g1
+ #rebalance: yes
+ redundancies: 1
+ disperses: 3
+ #replicas: 3
+ force: yes
+ options:
+ client.event-threads: "8"
+ server.event-threads: "8"
+ performance.stat-prefetch: "on"
+ nfs.disable: "on"
+ features.cache-invalidation: "on"
+ performance.client-io-threads: "on"
+ config.transport: tcp
+ performance.quick-read: "on"
+ performance.io-cache: "on"
+ nfs.export-volumes: "off"
+ cluster.lookup-optimize: "on"
+
+ cluster: "{% for selected_host in groups['cluster_nodes'] %}{{ hostvars[selected_host]['private_ip'] }}{{ ',' if not loop.last else '' }}{% endfor %}"
+ run_once: true
+
+- name: "Create mountpoint"
+ file: path=/mnt/glusterfs recurse=yes state=directory
+
+- name: "Flush handlers (umount glusterfs and restart ganesha)"
+ meta: flush_handlers
+
+- name: "Add fstab entry"
+ tags: gluster-fstab
+ mount:
+ path: /mnt/glusterfs
+ src: "{{ private_ip }}:/donnees"
+ fstype: glusterfs
+ opts: "defaults,_netdev,noauto,x-systemd.automount"
+ state: present
+
+- name: Mount everything
+ command: mount -a
+ args:
+ warn: no