diff --git a/cubox-i.xai-corp.net.yml b/cubox-i.xai-corp.net.yml new file mode 100644 index 0000000..96ecf07 --- /dev/null +++ b/cubox-i.xai-corp.net.yml @@ -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: diff --git a/dkhost.xai-corp.net.yml b/dkhost.xai-corp.net.yml index 96a1134..355f995 100644 --- a/dkhost.xai-corp.net.yml +++ b/dkhost.xai-corp.net.yml @@ -62,6 +62,7 @@ jenkins: host: gluster:/jenkins mount: /var/lib/jenkins + gluster_remove: elasticsearch: host: gluster:/elasticsearch mount: /data/elasticsearch diff --git a/dockerfiles/services/prometheus/docker-compose.yml b/dockerfiles/services/prometheus/docker-compose.yml new file mode 100644 index 0000000..03640f8 --- /dev/null +++ b/dockerfiles/services/prometheus/docker-compose.yml @@ -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 diff --git a/glusterfs.yml b/glusterfs.yml index 3682550..bc06317 100644 --- a/glusterfs.yml +++ b/glusterfs.yml @@ -4,31 +4,38 @@ - hosts: gfs remote_user: ansible - gather_facts: yes + gather_facts: no become: true vars: cluster: - - cubox-i.xai-corp.net + - cubox-i - home mountpoints: - /data/glusterfs/vmshares/brick1 - /data/glusterfs/gitea/brick1 - /data/glusterfs/jenkins/brick1 + - /data/glusterfs/jenkins2/brick1 - /data/glusterfs/tmp/brick1 - - /data/glusterfs/elasticsearch/brick1 +# - /data/glusterfs/elasticsearch/brick1 volumes: - vmshares: - - /data/glusterfs/vmshares/brick1/brick gitea: - /data/glusterfs/gitea/brick1/brick - jenkins: - - /data/glusterfs/jenkins/brick1/brick + jenkins2: + - /data/glusterfs/jenkins2/brick1/brick + vmshares: + - /data/glusterfs/vmshares/brick1/brick distributed_volumes: tmp: - /data/glusterfs/tmp/brick1/brick - elasticsearch: - - /data/glusterfs/elasticsearch/brick1/brick +# elasticsearch: +# - /data/glusterfs/elasticsearch/brick1/brick + + removed_volumes: +# jenkins: +# - /data/glusterfs/jenkins/brick1/brick +# tmp: +# - /data/glusterfs/tmp/brick1/brick roles: - glusterfs diff --git a/roles/cubox-i.xai-corp.net/defaults/main.yml b/roles/cubox-i.xai-corp.net/defaults/main.yml new file mode 100644 index 0000000..e35b1ec --- /dev/null +++ b/roles/cubox-i.xai-corp.net/defaults/main.yml @@ -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 diff --git a/roles/cubox-i.xai-corp.net/tasks/main.yml b/roles/cubox-i.xai-corp.net/tasks/main.yml new file mode 100644 index 0000000..c5c1a75 --- /dev/null +++ b/roles/cubox-i.xai-corp.net/tasks/main.yml @@ -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 diff --git a/roles/dockerhost/tasks/fstab.yml b/roles/dockerhost/tasks/fstab.yml index 63ccc9d..d289f49 100644 --- a/roles/dockerhost/tasks/fstab.yml +++ b/roles/dockerhost/tasks/fstab.yml @@ -15,3 +15,12 @@ regexp: '^#?{{ item.value.host }}' line: '{{ item.value.host }} {{ item.value.mount }} glusterfs direct-io-mode=disable,defaults,_netdev 0 0' 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 diff --git a/roles/glusterfs/tasks/main.yml b/roles/glusterfs/tasks/main.yml index ec0dae4..5ca21a6 100644 --- a/roles/glusterfs/tasks/main.yml +++ b/roles/glusterfs/tasks/main.yml @@ -23,13 +23,26 @@ 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 @@ -51,6 +64,8 @@ brick: '{{ item.value | join(",")}}' rebalance: no replicas: false + force: true cluster: "{{cluster}}" with_dict: "{{distributed_volumes}}" run_once: true + diff --git a/roles/motd/tasks/main.yml b/roles/motd/tasks/main.yml index e7fe617..d88ce54 100644 --- a/roles/motd/tasks/main.yml +++ b/roles/motd/tasks/main.yml @@ -14,7 +14,7 @@ - figlet - update-motd - lm-sensors - when: ansible_architecture == 'armv7l' + when: ansible_architecture !== 'armv7l' - name: remove help text @@ -24,7 +24,7 @@ with_items: - /etc/update-motd.d/10-help-text - /etc/update-motd.d/51-cloudguest - when: ansible_architecture == 'armv7l' + when: ansible_architecture !== 'armv7l' - name: add new info @@ -35,4 +35,4 @@ with_items: - { src: hostname.sh, dest: 10-hostname } - { src: systats.sh, dest: 11-sysstats} - when: ansible_architecture == 'armv7l' + when: ansible_architecture !== 'armv7l' diff --git a/roles/ns.xai-corp.net/templates/xai-corp.net.internal.j2 b/roles/ns.xai-corp.net/templates/xai-corp.net.internal.j2 index 94e87db..a1f9ed3 100644 --- a/roles/ns.xai-corp.net/templates/xai-corp.net.internal.j2 +++ b/roles/ns.xai-corp.net/templates/xai-corp.net.internal.j2 @@ -38,7 +38,7 @@ ns02 IN CNAME cubox-i ; gluster servers gluster IN A 192.168.2.11 -gluster IN A 192.168.2.12 +;gluster IN A 192.168.2.12 ; docker swarm nodes dkhost IN A 192.168.2.11 diff --git a/scripts/ansible.sh b/scripts/ansible.sh index 680a572..d84a2a3 100644 --- a/scripts/ansible.sh +++ b/scripts/ansible.sh @@ -2,4 +2,4 @@ # 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