aboutsummaryrefslogtreecommitdiff
path: root/os_config/roles/storage/tasks/main.yml
blob: a1f2d8f301eb6b7bce36fcb64ac09aea78faf96c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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