Skip to content

Commit

Permalink
PMM-12693 remove more CentOS 7 tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Nov 29, 2023
1 parent 8ff568a commit 37a6510
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 205 deletions.
33 changes: 13 additions & 20 deletions build/ansible/pmm/post-build-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
35 changes: 0 additions & 35 deletions build/ansible/roles/ami-ovf/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -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 >/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 >/dev/null 2>&1 &
when:
Expand Down
38 changes: 0 additions & 38 deletions build/ansible/roles/cloud-node/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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'
Expand All @@ -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'
Expand Down Expand Up @@ -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"
Expand Down
9 changes: 0 additions & 9 deletions build/ansible/roles/supervisord-init/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down
15 changes: 0 additions & 15 deletions update/ansible/playbook/tasks/roles/clickhouse/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
73 changes: 0 additions & 73 deletions update/ansible/playbook/tasks/roles/postgres/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 0 additions & 5 deletions update/ansible/playbook/tasks/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 37a6510

Please sign in to comment.