update glusterfs role to include deployment of gluster_exporter for prometheus
This commit is contained in:
@@ -13,59 +13,8 @@
|
|||||||
- xfsprogs
|
- xfsprogs
|
||||||
- xfsdump
|
- xfsdump
|
||||||
|
|
||||||
|
- include: manage_volumes.yml
|
||||||
|
|
||||||
# create mount points
|
- include: prometheus_exporter.yml
|
||||||
- name: create mount points for all bricks in all volumes
|
|
||||||
file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
state: directory
|
|
||||||
mode: 0755
|
|
||||||
with_items: "{{mountpoints}}"
|
|
||||||
|
|
||||||
# manage volumes
|
|
||||||
#- name: remove old gluster volumes
|
|
||||||
# gluster_volume:
|
|
||||||
# state: absent
|
|
||||||
# name: "{{ item.key }}"
|
|
||||||
# rebalance: no
|
|
||||||
# replicas: false
|
|
||||||
# cluster: "{{cluster}}"
|
|
||||||
# with_dict: "{{removed_volumes}}"
|
|
||||||
# run_once: true
|
|
||||||
|
|
||||||
|
|
||||||
- name: create gluster volumes
|
|
||||||
gluster_volume:
|
|
||||||
state: present
|
|
||||||
start_on_create: yes
|
|
||||||
name: "{{ item.key }}"
|
|
||||||
brick: '{{ item.value | join(",")}}'
|
|
||||||
rebalance: no
|
|
||||||
replicas: 2
|
|
||||||
force: true
|
|
||||||
cluster: "{{cluster}}"
|
|
||||||
with_dict: "{{volumes}}"
|
|
||||||
run_once: true
|
|
||||||
|
|
||||||
#- name: create tmp gluster volumes
|
|
||||||
# gluster_volume:
|
|
||||||
# state: present
|
|
||||||
# name: "tmp"
|
|
||||||
# brick: '/data/glusterfs/tmp/brick1/brick'
|
|
||||||
# rebalance: no
|
|
||||||
# replicas: 1
|
|
||||||
# cluster: "{{cluster}}"
|
|
||||||
# run_once: true
|
|
||||||
|
|
||||||
- name: create distributed gluster volumes
|
|
||||||
gluster_volume:
|
|
||||||
state: present
|
|
||||||
name: "{{ item.key }}"
|
|
||||||
brick: '{{ item.value | join(",")}}'
|
|
||||||
rebalance: no
|
|
||||||
replicas: false
|
|
||||||
force: true
|
|
||||||
cluster: "{{cluster}}"
|
|
||||||
with_dict: "{{distributed_volumes}}"
|
|
||||||
run_once: true
|
|
||||||
|
|
||||||
|
|||||||
57
roles/glusterfs/tasks/manage_volumes.yml
Normal file
57
roles/glusterfs/tasks/manage_volumes.yml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
---
|
||||||
|
# glusterfs mounts
|
||||||
|
|
||||||
|
# create mount points
|
||||||
|
- name: create mount points for all bricks in all volumes
|
||||||
|
file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
with_items: "{{mountpoints}}"
|
||||||
|
|
||||||
|
# manage volumes
|
||||||
|
#- name: remove old gluster volumes
|
||||||
|
# gluster_volume:
|
||||||
|
# state: absent
|
||||||
|
# name: "{{ item.key }}"
|
||||||
|
# rebalance: no
|
||||||
|
# replicas: false
|
||||||
|
# cluster: "{{cluster}}"
|
||||||
|
# with_dict: "{{removed_volumes}}"
|
||||||
|
# run_once: true
|
||||||
|
|
||||||
|
|
||||||
|
- name: create gluster volumes
|
||||||
|
gluster_volume:
|
||||||
|
state: present
|
||||||
|
start_on_create: yes
|
||||||
|
name: "{{ item.key }}"
|
||||||
|
brick: '{{ item.value | join(",")}}'
|
||||||
|
rebalance: no
|
||||||
|
replicas: 2
|
||||||
|
force: true
|
||||||
|
cluster: "{{cluster}}"
|
||||||
|
with_dict: "{{volumes}}"
|
||||||
|
run_once: true
|
||||||
|
|
||||||
|
#- name: create tmp gluster volumes
|
||||||
|
# gluster_volume:
|
||||||
|
# state: present
|
||||||
|
# name: "tmp"
|
||||||
|
# brick: '/data/glusterfs/tmp/brick1/brick'
|
||||||
|
# rebalance: no
|
||||||
|
# replicas: 1
|
||||||
|
# cluster: "{{cluster}}"
|
||||||
|
# run_once: true
|
||||||
|
|
||||||
|
- name: create distributed gluster volumes
|
||||||
|
gluster_volume:
|
||||||
|
state: present
|
||||||
|
name: "{{ item.key }}"
|
||||||
|
brick: '{{ item.value | join(",")}}'
|
||||||
|
rebalance: no
|
||||||
|
replicas: false
|
||||||
|
force: true
|
||||||
|
cluster: "{{cluster}}"
|
||||||
|
with_dict: "{{distributed_volumes}}"
|
||||||
|
run_once: true
|
||||||
31
roles/glusterfs/tasks/prometheus_exporter.yml
Normal file
31
roles/glusterfs/tasks/prometheus_exporter.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
# tasks to install prometheus gluster_exporter
|
||||||
|
# https://github.com/ofesseler/gluster_exporter
|
||||||
|
|
||||||
|
# install packages
|
||||||
|
- name: Update apt cache.
|
||||||
|
apt: update_cache=yes cache_valid_time=86400
|
||||||
|
|
||||||
|
- name: Install gluster_exporter dependencies.
|
||||||
|
apt: "name={{ item }} state=installed"
|
||||||
|
with_items:
|
||||||
|
- golang-go
|
||||||
|
|
||||||
|
- name: make golang workspace
|
||||||
|
file:
|
||||||
|
path: /opt/golang
|
||||||
|
state: directory
|
||||||
|
mode: 0775
|
||||||
|
|
||||||
|
- name: install gluster_exporter
|
||||||
|
shell: GOPATH=/opt/golang go get github.com/ofesseler/gluster_exporter
|
||||||
|
|
||||||
|
- name: add gluster_exporter to startup
|
||||||
|
lineinfile:
|
||||||
|
dest: /etc/rc.local
|
||||||
|
regexp: '/opt/golang/bin/gluster_exporter'
|
||||||
|
line: 'nohup /opt/golang/bin/gluster_exporter --profile &'
|
||||||
|
insertbefore: "^exit 0"
|
||||||
|
|
||||||
|
- name: start gluster_exporter
|
||||||
|
shell: nohup /opt/golang/bin/gluster_exporter --profile &
|
||||||
Reference in New Issue
Block a user