hacking at glusterfs
cubox-i role for specific configs
This commit is contained in:
20
cubox-i.xai-corp.net.yml
Normal file
20
cubox-i.xai-corp.net.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
# playbook to install tools on home.xai-corp.net
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
- hosts: cubox-i
|
||||||
|
remote_user: ansible
|
||||||
|
gather_facts: true
|
||||||
|
become: true
|
||||||
|
|
||||||
|
vars:
|
||||||
|
cleanup:
|
||||||
|
packages:
|
||||||
|
- git
|
||||||
|
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- cubox-i.xai-corp.net
|
||||||
|
|
||||||
|
post_tasks:
|
||||||
@@ -62,6 +62,7 @@
|
|||||||
jenkins:
|
jenkins:
|
||||||
host: gluster:/jenkins
|
host: gluster:/jenkins
|
||||||
mount: /var/lib/jenkins
|
mount: /var/lib/jenkins
|
||||||
|
gluster_remove:
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
host: gluster:/elasticsearch
|
host: gluster:/elasticsearch
|
||||||
mount: /data/elasticsearch
|
mount: /data/elasticsearch
|
||||||
|
|||||||
55
dockerfiles/services/prometheus/docker-compose.yml
Normal file
55
dockerfiles/services/prometheus/docker-compose.yml
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
---
|
||||||
|
# docker-compose file for owncloud server
|
||||||
|
|
||||||
|
# DOCKER_HOST=dkhost:2376 docker stack deploy -c docker-compose.yml metrics
|
||||||
|
# DOCKER_HOST=dkhost:2376 docker stack ps metrics
|
||||||
|
|
||||||
|
version: '3.4'
|
||||||
|
services:
|
||||||
|
|
||||||
|
prometheus:
|
||||||
|
image: prom/prometheus
|
||||||
|
ports:
|
||||||
|
- 9090:9090
|
||||||
|
# volumes:
|
||||||
|
# - /opt/shared/nextcloud/data:/var/www/html/data
|
||||||
|
logging:
|
||||||
|
driver: fluentd
|
||||||
|
options:
|
||||||
|
fluentd-address: "logs.xai-corp.net:24224"
|
||||||
|
fluentd-async-connect: 'true'
|
||||||
|
tag: postgres
|
||||||
|
networks:
|
||||||
|
- ingress
|
||||||
|
- prod
|
||||||
|
|
||||||
|
graphana:
|
||||||
|
image: grafana/grafana
|
||||||
|
ports:
|
||||||
|
- 3001:3000
|
||||||
|
environment:
|
||||||
|
GF_SECURITY_ADMIN_PASSWORD: sakas
|
||||||
|
# volumes:
|
||||||
|
# - /opt/shared/nextcloud/data:/var/www/html/data
|
||||||
|
networks:
|
||||||
|
- ingress
|
||||||
|
|
||||||
|
postgres_exported:
|
||||||
|
image: wrouesnel/postgres_exporter
|
||||||
|
environment:
|
||||||
|
DATA_SOURCE_NAME: "postgresql://xaicorp_admin:snqioxni1sw@tasks.postgres:5432/?sslmode=disable"
|
||||||
|
networks:
|
||||||
|
- ingress
|
||||||
|
- prod
|
||||||
|
|
||||||
|
|
||||||
|
networks:
|
||||||
|
default:
|
||||||
|
external:
|
||||||
|
name: ingress
|
||||||
|
ingress:
|
||||||
|
external:
|
||||||
|
name: ingress
|
||||||
|
prod:
|
||||||
|
external:
|
||||||
|
name: prod
|
||||||
@@ -4,31 +4,38 @@
|
|||||||
|
|
||||||
- hosts: gfs
|
- hosts: gfs
|
||||||
remote_user: ansible
|
remote_user: ansible
|
||||||
gather_facts: yes
|
gather_facts: no
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
cluster:
|
cluster:
|
||||||
- cubox-i.xai-corp.net
|
- cubox-i
|
||||||
- home
|
- home
|
||||||
mountpoints:
|
mountpoints:
|
||||||
- /data/glusterfs/vmshares/brick1
|
- /data/glusterfs/vmshares/brick1
|
||||||
- /data/glusterfs/gitea/brick1
|
- /data/glusterfs/gitea/brick1
|
||||||
- /data/glusterfs/jenkins/brick1
|
- /data/glusterfs/jenkins/brick1
|
||||||
|
- /data/glusterfs/jenkins2/brick1
|
||||||
- /data/glusterfs/tmp/brick1
|
- /data/glusterfs/tmp/brick1
|
||||||
- /data/glusterfs/elasticsearch/brick1
|
# - /data/glusterfs/elasticsearch/brick1
|
||||||
volumes:
|
volumes:
|
||||||
vmshares:
|
|
||||||
- /data/glusterfs/vmshares/brick1/brick
|
|
||||||
gitea:
|
gitea:
|
||||||
- /data/glusterfs/gitea/brick1/brick
|
- /data/glusterfs/gitea/brick1/brick
|
||||||
jenkins:
|
jenkins2:
|
||||||
- /data/glusterfs/jenkins/brick1/brick
|
- /data/glusterfs/jenkins2/brick1/brick
|
||||||
|
vmshares:
|
||||||
|
- /data/glusterfs/vmshares/brick1/brick
|
||||||
distributed_volumes:
|
distributed_volumes:
|
||||||
tmp:
|
tmp:
|
||||||
- /data/glusterfs/tmp/brick1/brick
|
- /data/glusterfs/tmp/brick1/brick
|
||||||
elasticsearch:
|
# elasticsearch:
|
||||||
- /data/glusterfs/elasticsearch/brick1/brick
|
# - /data/glusterfs/elasticsearch/brick1/brick
|
||||||
|
|
||||||
|
removed_volumes:
|
||||||
|
# jenkins:
|
||||||
|
# - /data/glusterfs/jenkins/brick1/brick
|
||||||
|
# tmp:
|
||||||
|
# - /data/glusterfs/tmp/brick1/brick
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- glusterfs
|
- glusterfs
|
||||||
|
|||||||
33
roles/cubox-i.xai-corp.net/defaults/main.yml
Normal file
33
roles/cubox-i.xai-corp.net/defaults/main.yml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
# defaults/main.yml
|
||||||
|
# define default variable values here
|
||||||
|
#/dev/sda6 /data/glusterfs/vmshares/brick1 xfs defaults 0 0
|
||||||
|
|
||||||
|
cubox-i:
|
||||||
|
fstab:
|
||||||
|
add:
|
||||||
|
vmshare:
|
||||||
|
host: /dev/sda6
|
||||||
|
mount: /data/glusterfs/vmshares/brick1
|
||||||
|
fstype: xfs
|
||||||
|
attr: defaults
|
||||||
|
gitea:
|
||||||
|
host: /dev/sda7
|
||||||
|
mount: /data/glusterfs/gitea/brick1
|
||||||
|
fstype: xfs
|
||||||
|
attr: defaults
|
||||||
|
vmshare:
|
||||||
|
host: /dev/sda8
|
||||||
|
mount: /data/glusterfs/jenkins/brick1
|
||||||
|
fstype: xfs
|
||||||
|
attr: defaults
|
||||||
|
gitea:
|
||||||
|
host: /dev/sda9
|
||||||
|
mount: /data/glusterfs/tmp/brick1
|
||||||
|
fstype: xfs
|
||||||
|
attr: defaults
|
||||||
|
gitea:
|
||||||
|
host: /dev/sda10
|
||||||
|
mount: /data/glusterfs/elasticsearch/brick1
|
||||||
|
fstype: xfs
|
||||||
|
attr: defaults
|
||||||
22
roles/cubox-i.xai-corp.net/tasks/main.yml
Normal file
22
roles/cubox-i.xai-corp.net/tasks/main.yml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
# main tasks for special cubox-i config
|
||||||
|
|
||||||
|
|
||||||
|
- name: create mount points
|
||||||
|
file:
|
||||||
|
path: "{{ item.value.mount }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0755
|
||||||
|
with_dict: cubox-i.fstab.add
|
||||||
|
|
||||||
|
- name: create glusterfs mount hosts file entries
|
||||||
|
lineinfile:
|
||||||
|
state: present
|
||||||
|
dest: /etc/fstab
|
||||||
|
insertafter: EOF
|
||||||
|
regexp: '^#?{{ item.value.host }}'
|
||||||
|
line: '{{ item.value.host }} {{ item.value.mount }} {{ item.value.fstype }} {{ item.value.attr }} 0 0'
|
||||||
|
with_dict: cubox-i.fstab.add
|
||||||
|
|
||||||
|
|
||||||
|
- name: mute syslog
|
||||||
@@ -15,3 +15,12 @@
|
|||||||
regexp: '^#?{{ item.value.host }}'
|
regexp: '^#?{{ item.value.host }}'
|
||||||
line: '{{ item.value.host }} {{ item.value.mount }} glusterfs direct-io-mode=disable,defaults,_netdev 0 0'
|
line: '{{ item.value.host }} {{ item.value.mount }} glusterfs direct-io-mode=disable,defaults,_netdev 0 0'
|
||||||
with_dict: gluster
|
with_dict: gluster
|
||||||
|
|
||||||
|
- name: remove glusterfs mount hosts file entries
|
||||||
|
lineinfile:
|
||||||
|
state: absent
|
||||||
|
dest: /etc/fstab
|
||||||
|
insertafter: EOF
|
||||||
|
regexp: '^#?{{ item.value.host }}'
|
||||||
|
line: '{{ item.value.host }} {{ item.value.mount }} glusterfs direct-io-mode=disable,defaults,_netdev 0 0'
|
||||||
|
with_dict: gluster_remove
|
||||||
|
|||||||
@@ -23,13 +23,26 @@
|
|||||||
with_items: "{{mountpoints}}"
|
with_items: "{{mountpoints}}"
|
||||||
|
|
||||||
# manage volumes
|
# 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
|
- name: create gluster volumes
|
||||||
gluster_volume:
|
gluster_volume:
|
||||||
state: present
|
state: present
|
||||||
|
start_on_create: yes
|
||||||
name: "{{ item.key }}"
|
name: "{{ item.key }}"
|
||||||
brick: '{{ item.value | join(",")}}'
|
brick: '{{ item.value | join(",")}}'
|
||||||
rebalance: no
|
rebalance: no
|
||||||
replicas: 2
|
replicas: 2
|
||||||
|
force: true
|
||||||
cluster: "{{cluster}}"
|
cluster: "{{cluster}}"
|
||||||
with_dict: "{{volumes}}"
|
with_dict: "{{volumes}}"
|
||||||
run_once: true
|
run_once: true
|
||||||
@@ -51,6 +64,8 @@
|
|||||||
brick: '{{ item.value | join(",")}}'
|
brick: '{{ item.value | join(",")}}'
|
||||||
rebalance: no
|
rebalance: no
|
||||||
replicas: false
|
replicas: false
|
||||||
|
force: true
|
||||||
cluster: "{{cluster}}"
|
cluster: "{{cluster}}"
|
||||||
with_dict: "{{distributed_volumes}}"
|
with_dict: "{{distributed_volumes}}"
|
||||||
run_once: true
|
run_once: true
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
- figlet
|
- figlet
|
||||||
- update-motd
|
- update-motd
|
||||||
- lm-sensors
|
- lm-sensors
|
||||||
when: ansible_architecture == 'armv7l'
|
when: ansible_architecture !== 'armv7l'
|
||||||
|
|
||||||
|
|
||||||
- name: remove help text
|
- name: remove help text
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
with_items:
|
with_items:
|
||||||
- /etc/update-motd.d/10-help-text
|
- /etc/update-motd.d/10-help-text
|
||||||
- /etc/update-motd.d/51-cloudguest
|
- /etc/update-motd.d/51-cloudguest
|
||||||
when: ansible_architecture == 'armv7l'
|
when: ansible_architecture !== 'armv7l'
|
||||||
|
|
||||||
|
|
||||||
- name: add new info
|
- name: add new info
|
||||||
@@ -35,4 +35,4 @@
|
|||||||
with_items:
|
with_items:
|
||||||
- { src: hostname.sh, dest: 10-hostname }
|
- { src: hostname.sh, dest: 10-hostname }
|
||||||
- { src: systats.sh, dest: 11-sysstats}
|
- { src: systats.sh, dest: 11-sysstats}
|
||||||
when: ansible_architecture == 'armv7l'
|
when: ansible_architecture !== 'armv7l'
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ ns02 IN CNAME cubox-i
|
|||||||
|
|
||||||
; gluster servers
|
; gluster servers
|
||||||
gluster IN A 192.168.2.11
|
gluster IN A 192.168.2.11
|
||||||
gluster IN A 192.168.2.12
|
;gluster IN A 192.168.2.12
|
||||||
|
|
||||||
; docker swarm nodes
|
; docker swarm nodes
|
||||||
dkhost IN A 192.168.2.11
|
dkhost IN A 192.168.2.11
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
# run ansible playbook to update name servers
|
# run ansible playbook to update name servers
|
||||||
|
|
||||||
ansible-playbook -vv ${PLAYBOOK}.yml -i inventory.conf -u ansible
|
ansible-playbook -vvv ${PLAYBOOK}.yml -i inventory.conf -u ansible
|
||||||
|
|||||||
Reference in New Issue
Block a user