From 5a15f65db3dfb245919bdd534e93bd711db2eb60 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sat, 24 Mar 2018 03:05:47 +0100 Subject: Minor tunning --- roles/ands_backup/templates/backup.sh.j2 | 11 +++++++++-- roles/ands_network/defaults/main.yml | 2 +- roles/ands_network/files/firewalld/galera.xml | 10 ++++++++++ roles/ands_network/files/firewalld/haproxy-stats.xml | 6 ++++++ roles/ands_network/files/firewalld/netpipe.xml | 6 ++++++ roles/ands_network/files/galera.xml | 10 ---------- roles/ands_network/files/netpipe.xml | 6 ------ roles/ands_network/tasks/firewall.yml | 12 +++++++++--- roles/ands_network/tasks/firewall_service.yml | 2 +- 9 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 roles/ands_network/files/firewalld/galera.xml create mode 100644 roles/ands_network/files/firewalld/haproxy-stats.xml create mode 100644 roles/ands_network/files/firewalld/netpipe.xml delete mode 100644 roles/ands_network/files/galera.xml delete mode 100644 roles/ands_network/files/netpipe.xml (limited to 'roles') diff --git a/roles/ands_backup/templates/backup.sh.j2 b/roles/ands_backup/templates/backup.sh.j2 index c362957..b9884ea 100755 --- a/roles/ands_backup/templates/backup.sh.j2 +++ b/roles/ands_backup/templates/backup.sh.j2 @@ -37,13 +37,20 @@ etcdctl3 --endpoints="192.168.213.1:2379" snapshot save "$backup_path/etcd/snaps mkdir -p "$backup_path/heketi" || { echo "Can't create ${backup_path}/heketi" ; exit 1 ; } heketi-cli -s http://heketi-storage.glusterfs.svc.cluster.local:8080 --user admin --secret "$(oc get secret heketi-storage-admin-secret -n glusterfs -o jsonpath='{.data.key}' | base64 -d)" topology info > "$backup_path/heketi/heketi_topology.json" heketi-cli -s http://heketi-storage.glusterfs.svc.cluster.local:8080 --user admin --secret "$(oc get secret heketi-storage-admin-secret -n glusterfs -o jsonpath='{.data.key}' | base64 -d)" db dump > "$backup_path/heketi/heketi_db.json" -lvs > "$backup_path/heketi/lvs.txt" 2>/dev/null -lvm fullreport --reportformat json > "$backup_path/heketi/lvm.json" 2>/dev/null gluster --xml volume info > "$backup_path/heketi/gluster-info.xml" gluster --xml volume status > "$backup_path/heketi/gluster-status.xml" gluster volume status > "$backup_path/heketi/gluster.txt" {% endif %} +mkdir -p "$backup_path/lvm" || { echo "Can't create ${backup_path}/lvm" ; exit 1 ; } +lvs > "$backup_path/lvm/lvs.txt" 2>/dev/null +lvm fullreport --reportformat json > "$backup_path/lvm/lvm.json" 2>/dev/null +dmsetup ls --tree > "$backup_path/lvm/dmesetup.txt" 2>/dev/null +vglist=$(vgdisplay | grep -oP "VG Name\s+\K.*") +for vg in $vglist; do + vgcfgbackup -f "$backup_path/lvm/vg-$vg.backup" "$vg" &>/dev/null +done + {% if 'ands_storage_servers' in group_names %} # Gluster diff --git a/roles/ands_network/defaults/main.yml b/roles/ands_network/defaults/main.yml index 0170370..c2538f9 100644 --- a/roles/ands_network/defaults/main.yml +++ b/roles/ands_network/defaults/main.yml @@ -1,3 +1,3 @@ configure_network: "{{ ands_configure_network | default(false) }}" firewall_template_path: "{{ ands_paths.provision }}/firewall/{{ ansible_hostname }}" -firewall_services: [ 'galera', 'netpipe' ] \ No newline at end of file +firewall_enabled_services: "{{ ands_firewall_enabled_services }}" diff --git a/roles/ands_network/files/firewalld/galera.xml b/roles/ands_network/files/firewalld/galera.xml new file mode 100644 index 0000000..15f908b --- /dev/null +++ b/roles/ands_network/files/firewalld/galera.xml @@ -0,0 +1,10 @@ + + + MySQL/Galera + MySQL/Galera Database Server + + + + + + diff --git a/roles/ands_network/files/firewalld/haproxy-stats.xml b/roles/ands_network/files/firewalld/haproxy-stats.xml new file mode 100644 index 0000000..b574be7 --- /dev/null +++ b/roles/ands_network/files/firewalld/haproxy-stats.xml @@ -0,0 +1,6 @@ + + + haproxy-stats + OpenShift HAProxy router statistics + + diff --git a/roles/ands_network/files/firewalld/netpipe.xml b/roles/ands_network/files/firewalld/netpipe.xml new file mode 100644 index 0000000..0e7f355 --- /dev/null +++ b/roles/ands_network/files/firewalld/netpipe.xml @@ -0,0 +1,6 @@ + + + NetPIPE + NetPIPE network benchmark + + diff --git a/roles/ands_network/files/galera.xml b/roles/ands_network/files/galera.xml deleted file mode 100644 index 15f908b..0000000 --- a/roles/ands_network/files/galera.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - MySQL/Galera - MySQL/Galera Database Server - - - - - - diff --git a/roles/ands_network/files/netpipe.xml b/roles/ands_network/files/netpipe.xml deleted file mode 100644 index 0e7f355..0000000 --- a/roles/ands_network/files/netpipe.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - NetPIPE - NetPIPE network benchmark - - diff --git a/roles/ands_network/tasks/firewall.yml b/roles/ands_network/tasks/firewall.yml index d5ba5f3..280a172 100644 --- a/roles/ands_network/tasks/firewall.yml +++ b/roles/ands_network/tasks/firewall.yml @@ -12,15 +12,21 @@ - name: Configure missing firewalld services include_tasks: firewall_service.yml - with_items: "{{ firewall_services }}" + with_items: "{{ lookup('pipe', filesearch).split('\n') }}" vars: + filesearch: "find {{ role_path }}/files/firewalld -name *.xml -mindepth 1 -maxdepth 1" + service: "{{ item | basename | regex_replace('\\.xml','') }}" servicelist: "{{ services.stdout_lines }}" - loop_control: - loop_var: service - name: Reload firewalld rules shell: firewall-cmd --reload +- name: Enable requested services + firewalld: service="{{ item }}" state="enabled" permanent="true" immediate="true" + when: ands_hostnet_db | default(false) + with_items: "{{ firewall_enabled_services }}" + + - name: Enable MySQL and Galera services if ands_hostnet_db is enabled firewalld: service="{{ item }}" state="enabled" permanent="true" immediate="true" when: ands_hostnet_db | default(false) diff --git a/roles/ands_network/tasks/firewall_service.yml b/roles/ands_network/tasks/firewall_service.yml index 98bc866..d3c6e9b 100644 --- a/roles/ands_network/tasks/firewall_service.yml +++ b/roles/ands_network/tasks/firewall_service.yml @@ -1,5 +1,5 @@ - name: "Copy firewalld service '{{ service }}'" - copy: src="{{ service }}.xml" dest="{{ firewall_template_path }}/{{ service }}.xml" owner=root group=root mode="0644" + copy: src="firewalld/{{ service }}.xml" dest="{{ firewall_template_path }}/{{ service }}.xml" owner=root group=root mode="0644" register: result - name: "Delete old version of firewalld service '{{ service }}'" -- cgit v1.2.3