setup docker hosts to mount glusterfs mounts

move git.xai-corp.net to dkhost02
This commit is contained in:
2017-05-26 09:10:07 -04:00
parent 3866d4c17b
commit 165e5ffe54
9 changed files with 110 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
# playbook for home02
- hosts: dkhost01
- hosts: dkhost02
remote_user: ansible
gather_facts: yes
become: true
@@ -46,12 +46,23 @@
access_log: "/var/log/nginx/xaicorp.access.log"
error_log: "/var/log/nginx/xaicorp.error.log"
gluster:
vmshare:
host: gluster:/vmshares
mount: /opt/shared
gitea:
host: gluster:/gitea
mount: /var/lib/gitea
jenkins:
host: gluster:/jenkins
mount: /var/lib/jenkins
roles:
# - _install_updates
# - Datadog.datadog
- dockerhost
- geerlingguy.nginx
- certbot
# - certbot
# - docker_registry
# - docker_graylog

View File

@@ -25,7 +25,7 @@ server {
add_header Strict-Transport-Security "max-age=600; includeSubDomains" always;
location / {
proxy_pass http://192.168.2.41:10080;
proxy_pass http://192.168.2.43:10080;
}
}

32
glusterfs.yml Normal file
View File

@@ -0,0 +1,32 @@
---
# playbook for home02
- hosts: gfs
remote_user: ansible
gather_facts: yes
become: true
vars:
cluster:
- cubox-i.xai-corp.net
# - home
mountpoints:
- /data/glusterfs/vmshares/brick1
- /data/glusterfs/gitea/brick1
- /data/glusterfs/jenkins/brick1
volumes:
vmshares:
- /data/glusterfs/vmshares/brick1/brick
gitea:
- /data/glusterfs/gitea/brick1/brick
jenkins:
- /data/glusterfs/jenkins/brick1/brick
roles:
- glusterfs
# - td-agent-bit
post_tasks:
- name: check service is up
service: name=glusterfs-server state=started

View File

@@ -0,0 +1,17 @@
---
- name: create mount points
file:
path: "{{ item.value.mount }}"
state: directory
mode: 0755
with_dict: gluster
- 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 }} glusterfs defaults,_netdev 0 0'
with_dict: gluster

View File

@@ -11,6 +11,9 @@
- "wget"
- "apt-transport-https"
- "ca-certificates"
- "glusterfs-client"
- xfsprogs
- attr
#- name: install repo keys
# apt_key:

View File

@@ -4,3 +4,5 @@
- include: "install-xenial.yml"
when: ansible_distribution_release == "xenial"
become: true
- include: "fstab.yml"

View File

@@ -0,0 +1,34 @@
---
# main tasks for installing glusterfs
# install packages
- name: Update apt cache.
apt: update_cache=yes cache_valid_time=86400
- name: Ensure glusterfs server is installed.
apt: "name={{ item }} state=installed"
with_items:
- glusterfs-server
- xfsprogs
- xfsdump
# 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: create gluster volumes
gluster_volume:
state: present
name: "{{ item.key }}"
brick: '{{ item.value | join(",")}}'
rebalance: no
cluster: "{{cluster}}"
with_dict: "{{volumes}}"
run_once: true

View File

@@ -24,6 +24,8 @@ garden IN A 192.168.2.20
home IN A 192.168.2.11
cubox-i IN A 192.168.2.12
ns02 IN A 192.168.2.12
gluster IN A 192.168.2.12
home02 IN A 192.168.2.22

View File

@@ -15,5 +15,9 @@ $ORIGIN 2.168.192.IN-ADDR.ARPA.
14 IN PTR laser.xai-corp.net.
16 IN PTR tv.xai-corp.net.
103 IN PTR xaicorp1.xai-corp.net.
12 IN PTR home.xai-corp.net.
11 IN PTR home.xai-corp.net.
12 IN PTR cubox-i.xai-corp.net.
20 IN PTR garden.xai-corp.net.
22 IN PTR home02.xai-corp.net.
41 IN PTR dkhost01.xai-corp.net.
43 IN PTR dkhost02.xai-corp.net.