Skip to content

Commit

Permalink
Customization of the prometheus asnible roles
Browse files Browse the repository at this point in the history
  • Loading branch information
veldrane committed Oct 16, 2020
1 parent a70cf6f commit 49a030c
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 7 deletions.
1 change: 1 addition & 0 deletions 04_pg95db/ansible/01_prepare_nodes.yaml
29 changes: 29 additions & 0 deletions 04_pg95db/ansible/include/_setup_vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
- name: Set global variables
set_fact:
virbr: "8"
netsuffix: "26"
hostname: "pgdb95"
domain: "lab.local"
mem: "4G"
ipaserver: "freeipa.lab.local"
ipaip: "10.1.8.10"
ldapbase: "dc=lab,dc=local"
svcadmin: "admin"
adminpwd: "admin123"
template: "t_centos7"
template_dir: "/data/templates"
vms_dir: "/data/vms"

- name: Set ip
set_fact:
ip: "10.1.{{ virbr }}.{{ netsuffix }}"



- name: Set FQDN
set_fact:
fqdn: "{{ hostname }}.{{ domain }}"

- name: Set REALM
set_fact:
realm: "{{ domain|upper }}"
1 change: 1 addition & 0 deletions 06_registry/ansible/02_install_registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,5 @@
-e REGISTRY_HTTP_ADDR=0.0.0.0:443 \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/var/lib/registry/certs/{{ fqdn }}.pem \
-e REGISTRY_HTTP_TLS_KEY=/var/lib/registry/certs/{{ fqdn }}.key \
-e REGISTRY_STORAGE_DELETE_ENABLED=true \
registry
2 changes: 1 addition & 1 deletion 06_registry/scripts/install-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ docker pull jc21/registry-ui:latest
docker tag jc21/registry-ui registry.lab.local/openshift/registry-ui:latest
docker push registry.lab.local/openshift/registry-ui:latest

docker run -d -it -p 80:80 -e REGISTRY_HOST=registry.lab.local:443 -e REGISTRY_SSL=true -e REGISTRY_DOMAIN=registry.lab.local:443 --name registry-ui registry.lab.local/openshift/registry-ui:latest
docker run -d -it -p 80:80 -e REGISTRY_HOST=registry.lab.local:443 -e REGISTRY_STORAGE_DELETE_ENABLED=true -e REGISTRY_SSL=true -e REGISTRY_DOMAIN=registry.lab.local:443 --name registry-ui registry.lab.local/openshift/registry-ui:latest
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
- name: "Create ansible group for new hosts"
add_host: name="{{ ip }}" groups=newhost

- name: Create nfs home data disk
shell: qemu-img create -f qcow2 {{ vms_dir }}/{{ fqdn }}/nfsvg.qcow2 {{ disksize }}
- name: Create prometheus data disk
shell: qemu-img create -f qcow2 {{ vms_dir }}/{{ fqdn }}/promvg.qcow2 {{ disksize }}

- name: Attach disk to machine
shell: virsh attach-disk {{ fqdn }} --source {{ vms_dir }}/{{ fqdn }}/nfsvg.qcow2 --target vdb --subdriver qcow2 --targetbus virtio --persistent
shell: virsh attach-disk {{ fqdn }} --source {{ vms_dir }}/{{ fqdn }}/promvg.qcow2 --target vdb --subdriver qcow2 --targetbus virtio --persistent

- name: Autostart of the machine
shell: virsh autostart {{ fqdn }}
Expand All @@ -28,7 +28,13 @@
include: include/_setup_vars.yaml

- name: Setup firewall rules
shell: firewall-cmd --permanent --add-service={mountd,nfs,rpc-bind} ; firewall-cmd --reload
shell: firewall-cmd --permanent --add-port=9090-9094/tcp --add-port=443/tcp ; firewall-cmd --reload

- name: LV extend /lv-var
shell: lvresize /dev/rootvg/var -L+10G

- name: Resize fs
shell: resize2fs /dev/rootvg/var

- name: Create datavg and logical volume
shell: pvcreate /dev/vdb ; vgcreate promvg /dev/vdb ; lvcreate -n data -L50G promvg
Expand All @@ -39,8 +45,8 @@
- name: make directory /prometheus/data
shell: mkdir -p /prometheus/data

- name: Add /nfshome to fstab
shell: echo '/dev/mapper/prometheus-data /prometheus/data ext4 noatime,nodiratime 1 2' >> /etc/fstab
- name: Add /prometheus/data to fstab
shell: echo '/dev/mapper/promvg-data /prometheus/data ext4 noatime,nodiratime 1 2' >> /etc/fstab

- name: Mount /prometheus/data
shell: mount /prometheus/data
37 changes: 37 additions & 0 deletions 15_prometheus/03_extend_cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
- hosts: localhost
become: true
gather_facts: no
tasks:

- name: Set variables
include: include/_setup_vars.yaml

- name: "Create ansible group for new hosts"
add_host: name="{{ master }}" groups=newhost

- hosts: newhost
become: true
gather_facts: no
tasks:

- name: Set variables
include: include/_setup_vars.yaml

- name: Copy cluster.ini
shell: cp /root/gshipley/cluster.ini /root/gshipley/prometheus.ini

- name: Add new hosts
shell: echo "[new_nodes]" >> /root/gshipley/prometheus.ini ; echo "{{ fqdn }} openshift_node_group_name='node-config-prometheus'" >> /root/gshipley/prometheus.ini

- name: Add section new nodes
shell: cd /root/gshipley ; sed -i -E 's/nodes$/nodes\nnew_nodes/' prometheus.ini

- name: Add host to ansible host
shell: echo "{{ fqdn }}" >> /etc/ansible/hosts

- name: setting up the node group
shell: cd /root/gshipley ; ansible-playbook -i prometheus.ini openshift-ansible/playbooks/openshift-master/openshift_node_group.yml

- name: Add new node to the cluster
shell: cd /root/gshipley ; ansible-playbook -i prometheus.ini openshift-ansible/playbooks/openshift-node/scaleup.yml
Empty file added 15_prometheus/README.md
Empty file.
4 changes: 4 additions & 0 deletions 15_prometheus/include/_setup_vars.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@
- name: Set disksize
set_fact:
disksize: "51G"

- name: Set ocp master
set_fact:
master: "node11.lab.local"

0 comments on commit 49a030c

Please sign in to comment.