From 37a6510e73d0b8c1f339e20a495d94d86a584c2d Mon Sep 17 00:00:00 2001 From: Alex Demidoff Date: Wed, 29 Nov 2023 01:28:14 +0000 Subject: [PATCH] PMM-12693 remove more CentOS 7 tasks --- build/ansible/pmm/post-build-actions.yml | 33 ++++----- build/ansible/roles/ami-ovf/tasks/main.yml | 35 --------- build/ansible/roles/cloud-node/tasks/main.yml | 38 ---------- .../roles/supervisord-init/tasks/main.yml | 9 --- .../tasks/roles/clickhouse/tasks/main.yml | 15 ---- .../roles/dashboards_upgrade/tasks/main.yml | 10 --- .../tasks/roles/postgres/tasks/main.yml | 73 ------------------- update/ansible/playbook/tasks/update.yml | 5 -- 8 files changed, 13 insertions(+), 205 deletions(-) diff --git a/build/ansible/pmm/post-build-actions.yml b/build/ansible/pmm/post-build-actions.yml index c6986c4eb5..07104b2363 100644 --- a/build/ansible/pmm/post-build-actions.yml +++ b/build/ansible/pmm/post-build-actions.yml @@ -71,7 +71,9 @@ --server-insecure-tls - name: Reread supervisord configuration EL9 - when: (ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux') and ansible_distribution_major_version == '9' + when: + - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' + - ansible_distribution_major_version == '9' command: /usr/local/bin/supervisorctl reread register: reread_result changed_when: "'No config updates to processes' not in reread_result.stdout" @@ -80,13 +82,13 @@ debug: var=reread_result.stdout_lines - name: Stop pmm-managed before deleting the database EL9 - when: (ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux') and ansible_distribution_major_version == '9' + when: + - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' + - ansible_distribution_major_version == '9' supervisorctl: name: pmm-managed state: stopped supervisorctl_path: /usr/local/bin/supervisorctl - # become: true - # ignore_errors: True - name: Supervisord stop | Stop supervisord service for AMI/OVF when: ansible_virtualization_type != "docker" @@ -114,16 +116,10 @@ ignore_errors: yes when: ansible_virtualization_type != "docker" - - name: Remove pmm-managed database EL7 - when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' - postgresql_db: - login_user: postgres - name: pmm-managed - state: absent - register: db_check_result - - name: Remove pmm-managed database EL9 - when: (ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux') and ansible_distribution_major_version == '9' + when: + - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' + - ansible_distribution_major_version == '9' postgresql_db: login_user: postgres name: pmm-managed @@ -136,7 +132,6 @@ msg: "pmm-managed database was removed" when: db_check_result.changed == True - - name: Remove pmm-managed role from postgres postgresql_user: name: pmm-managed @@ -153,10 +148,6 @@ when: ansible_virtualization_type != "docker" service: name=supervisord state=stopped enabled=yes - - name: Supervisord stop EL7 | Stop supervisord service for docker - when: ansible_virtualization_type == "docker" and ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' - shell: supervisorctl shutdown - - name: Supervisord stop EL9 | Stop supervisord service for docker when: ansible_virtualization_type == "docker" and (ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux') and ansible_distribution_major_version == '9' shell: /usr/local/bin/supervisorctl shutdown @@ -166,8 +157,10 @@ # "yum clean all" function will only remove cache from configured yum repositories # Details: https://bugzilla.redhat.com/show_bug.cgi?id=1357083 - - name: Remove yum cache | Remove yum cache dir - command: rm -rf /var/cache/yum + - name: Cleanup yum cache + file: + state: absent + path: /var/cache/yum - name: Post-build cleanup | Cleanup build logs and data file: path={{ item }} state=absent diff --git a/build/ansible/roles/ami-ovf/tasks/main.yml b/build/ansible/roles/ami-ovf/tasks/main.yml index 9aebe59308..d9431f4631 100644 --- a/build/ansible/roles/ami-ovf/tasks/main.yml +++ b/build/ansible/roles/ami-ovf/tasks/main.yml @@ -7,18 +7,6 @@ - name: Packages | Clean up yum metadata command: yum clean metadata -- name: Packages | Add PMM3 Server release repository for EL7 - when: - - ansible_distribution == 'CentOS' - - ansible_distribution_major_version == '7' - yum_repository: - name: pmm-server - description: PMM Server YUM repository - x86_64 - baseurl: https://repo.percona.com/pmm3-components/yum/experimental/7/RPMS/x86_64/ - gpgcheck: yes - enabled: yes - gpgkey: file:///etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY - - name: Packages | Add PMM3 Server release repository for EL9 when: - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' @@ -31,14 +19,6 @@ enabled: yes gpgkey: file:///etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY -- name: Disable SELinux | EL7 - when: - - ansible_distribution == 'CentOS' - - ansible_distribution_major_version == '7' - selinux: - policy: targeted - state: permissive - - name: Disable SELinux | EL9 when: - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' @@ -49,15 +29,6 @@ policy: targeted state: permissive -- name: Add firewalld rule | EL7 - when: - - ansible_distribution == 'CentOS' - - ansible_distribution_major_version == '7' - firewalld: port={{ item }} permanent=true state=enabled immediate=yes - with_items: - - 80/tcp - - 443/tcp - - name: Add firewalld rule | EL9 when: - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' @@ -86,12 +57,6 @@ - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' - ansible_distribution_major_version == '9' -- name: PMM | Delete centos EL7 - shell: cd /tmp; nohup sh -c "trap 'userdel -r centos' EXIT; sleep 600" /dev/null 2>&1 & - when: - - ansible_distribution == 'CentOS' - - ansible_distribution_major_version == '7' - - name: PMM | Delete ec2-user EL9 shell: cd /tmp; nohup sh -c "trap 'userdel -r ec2-user' EXIT; sleep 600" /dev/null 2>&1 & when: diff --git a/build/ansible/roles/cloud-node/tasks/main.yml b/build/ansible/roles/cloud-node/tasks/main.yml index b5fb6bcf6b..0f37c1b556 100644 --- a/build/ansible/roles/cloud-node/tasks/main.yml +++ b/build/ansible/roles/cloud-node/tasks/main.yml @@ -1,13 +1,5 @@ --- # Common things for all cloud images -- name: Packages | Add EPEL repository for EL7 - when: - - ansible_distribution == 'CentOS' - - ansible_distribution_major_version == '7' - yum: - name: https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm - state: installed - - name: Packages | Add EPEL repository for EL9 when: - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' @@ -16,19 +8,6 @@ name: epel-release state: installed -- name: Packages | Install OS tools for EL7 - when: - - ansible_distribution == 'CentOS' - - ansible_distribution_major_version == '7' - yum: - name: - - screen - - yum-utils - - cloud-init - - firewalld - - python2-pip - - ansible - - name: Packages | Install OS tools for EL9 when: - (ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux') and ansible_distribution_major_version == '9' @@ -41,16 +20,6 @@ - python3-libselinux - python3-firewall -- name: Firewalld | Start EL7 - when: - - ansible_distribution == 'CentOS' - - ansible_distribution_major_version == '7' - - ansible_os_family == 'RedHat' - service: - name: firewalld - state: started - enabled: yes - - name: Firewalld | Start EL9 when: - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' @@ -137,13 +106,6 @@ dest: /etc/sudoers.d/90-admin-user mode: 0440 -- name: change cloud user EL7 | Change cloud user - when: create_admin == "true" and ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' - replace: - dest: /etc/cloud/cloud.cfg - regexp: "name: centos" - replace: "name: admin" - - name: change cloud user for OVF EL9 | Change cloud user when: - create_admin == "true" diff --git a/build/ansible/roles/supervisord-init/tasks/main.yml b/build/ansible/roles/supervisord-init/tasks/main.yml index b2ed329987..73df7c6da8 100644 --- a/build/ansible/roles/supervisord-init/tasks/main.yml +++ b/build/ansible/roles/supervisord-init/tasks/main.yml @@ -1,9 +1,4 @@ --- -- name: Install supervisor | EL7 - when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' - pip: - name: supervisor==3.4.0 - - name: Install supervisor | EL9 when: (ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux') and ansible_distribution_major_version == '9' pip: @@ -13,10 +8,6 @@ when: (ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux') and ansible_distribution_major_version == '9' shell: if [ ! -e /usr/bin/supervisord ]; then ln -s /usr/local/bin/supervisord /usr/bin/supervisord; fi -- name: Configure supervisor EL7 | Create a default configuration file for supervisord - when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' - shell: echo_supervisord_conf > /etc/supervisord.conf - - name: Configure supervisor EL9 | Create a default configuration file for supervisord when: (ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux') and ansible_distribution_major_version == '9' shell: /usr/local/bin/echo_supervisord_conf > /etc/supervisord.conf diff --git a/update/ansible/playbook/tasks/roles/clickhouse/tasks/main.yml b/update/ansible/playbook/tasks/roles/clickhouse/tasks/main.yml index d5fa9f845e..cdd4ddeeea 100644 --- a/update/ansible/playbook/tasks/roles/clickhouse/tasks/main.yml +++ b/update/ansible/playbook/tasks/roles/clickhouse/tasks/main.yml @@ -1,14 +1,4 @@ --- -- name: Stop and remove clickhouse before update | EL7 - when: - - ansible_distribution == 'CentOS' - - ansible_distribution_major_version == '7' - command: supervisorctl {{ item }} clickhouse - changed_when: True - loop: - - stop - - remove - - name: Find supervisord's socket stat: path: /var/run/supervisor/supervisor.sock @@ -123,8 +113,3 @@ loop: - present - started - -- name: Start clickhouse EL7 - when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' - command: supervisorctl add clickhouse - changed_when: True diff --git a/update/ansible/playbook/tasks/roles/dashboards_upgrade/tasks/main.yml b/update/ansible/playbook/tasks/roles/dashboards_upgrade/tasks/main.yml index 8db53ed578..2a36bbbe0e 100644 --- a/update/ansible/playbook/tasks/roles/dashboards_upgrade/tasks/main.yml +++ b/update/ansible/playbook/tasks/roles/dashboards_upgrade/tasks/main.yml @@ -62,16 +62,6 @@ - name: Remove the old clickhouse plugin shell: grafana cli --pluginsDir /srv/grafana/plugins plugins remove vertamedia-clickhouse-datasource || true -- name: Restart grafana with new plugins EL7 - supervisorctl: - name: grafana - state: restarted - become: true - ignore_errors: true - when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' - # TODO: fix the race condition. - # We generate grafana supervisor config in pmm-managed and it may not exist at this stage - - name: Restart grafana with new plugins EL9 supervisorctl: name: grafana diff --git a/update/ansible/playbook/tasks/roles/postgres/tasks/main.yml b/update/ansible/playbook/tasks/roles/postgres/tasks/main.yml index e70c17ca80..1b1dd56d42 100644 --- a/update/ansible/playbook/tasks/roles/postgres/tasks/main.yml +++ b/update/ansible/playbook/tasks/roles/postgres/tasks/main.yml @@ -1,43 +1,5 @@ --- # Install Postgres -- name: Install Postgres for EL7 - block: - - name: Add PostgreSQL 14 YUM repository for EL7 - yum_repository: - name: percona-ppg-14 - description: PostgreSQL YUM repository - x86_64 - baseurl: http://repo.percona.com/ppg-14/yum/release/7/RPMS/x86_64 - gpgcheck: yes - enabled: yes - gpgkey: file:///etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY - - - name: Add PostgreSQL 11 YUM repository for EL7 - yum_repository: - name: percona-ppg-11 - description: PostgreSQL YUM repository - x86_64 - baseurl: http://repo.percona.com/ppg-11/yum/release/7/RPMS/x86_64 - gpgcheck: yes - enabled: yes - gpgkey: file:///etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY - - # we need the old postgres binary for the upgrade process - - name: Install Postgres - when: - - not ansible_check_mode - yum: - name: - - percona-postgresql14-server - - percona-postgresql14-contrib - - percona-postgresql14 - - percona-postgresql11-server - - percona-postgresql11-contrib - - percona-postgresql11 - - python-psycopg2 # Python PostgreSQL database adapterĀ§ - state: installed - when: - - ansible_distribution == "CentOS" - - ansible_distribution_major_version == "7" - - name: Install Postgres for EL9 block: - name: Add PostgreSQL 14 YUM repository for EL9 @@ -118,18 +80,6 @@ path: /var/run/supervisor/supervisor.sock register: is_upgrade - - name: Stop pmm-managed and postgres before backup database | EL7 - supervisorctl: - name: "{{ item }}" - state: stopped - loop: - - pmm-managed - - postgresql - become: true - when: - - is_upgrade.stat.exists - - ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' - - name: Stop pmm-managed and postgres before backup database | EL9 supervisorctl: name: "{{ item }}" @@ -217,25 +167,11 @@ state: absent when: is_upgrade.stat.exists - - name: Reread supervisord configuration EL7 - when: is_upgrade.stat.exists and ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' - command: supervisorctl reread - - name: Reread supervisord configuration EL9 when: is_upgrade.stat.exists and (ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux') and ansible_distribution_major_version == '9' command: /usr/local/bin/supervisorctl reread become: true - - name: Restart Postgres | EL7 - command: supervisorctl {{ item }} postgresql - changed_when: True - become: true - loop: - - stop - - remove - - add - when: is_upgrade.stat.exists and ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' - - name: Restart Postgres | EL9 command: /usr/local/bin/supervisorctl {{ item }} postgresql changed_when: True @@ -246,15 +182,6 @@ - add when: is_upgrade.stat.exists and (ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux') and ansible_distribution_major_version == '9' - - name: Run pmm-managed again | EL7 - supervisorctl: - name: pmm-managed - state: started - become: true - when: - - is_upgrade.stat.exists - - ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' - - name: Run pmm-managed again | EL9 supervisorctl: name: pmm-managed diff --git a/update/ansible/playbook/tasks/update.yml b/update/ansible/playbook/tasks/update.yml index d34efa784d..c84b100af6 100644 --- a/update/ansible/playbook/tasks/update.yml +++ b/update/ansible/playbook/tasks/update.yml @@ -381,8 +381,3 @@ file: state: absent path: /usr/share/pmm-server/maintenance/maintenance.html - - - name: Cleanup yum cache - file: - state: absent - path: /var/cache/yum