Skip to content

Commit

Permalink
PMM-9769 update all components (#2478)
Browse files Browse the repository at this point in the history
* PMM-9769 Use ansible-core instead of ansible package.
* PMM-9769 Update all components.
  • Loading branch information
talhabinrizwan authored Sep 15, 2023
1 parent 1cb518a commit 576142a
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 24 deletions.
31 changes: 29 additions & 2 deletions build/ansible/roles/ami-ovf/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,39 @@
enabled: yes
gpgkey: file:///etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY

- name: Disable SELinux
- name: Disable SELinux | EL7
when:
- ansible_distribution == 'CentOS'
- ansible_distribution_major_version == '7'
selinux:
policy: targeted
state: permissive

- name: PMM | Add firewalld rule
- name: Disable SELinux | EL9
when:
- ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux'
- ansible_distribution_major_version == '9'
vars:
ansible_python_interpreter: /usr/bin/python3.9
selinux:
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'
- ansible_distribution_major_version == '9'
vars:
ansible_python_interpreter: /usr/bin/python3.9
firewalld: port={{ item }} permanent=true state=enabled immediate=yes
with_items:
- 80/tcp
Expand Down
23 changes: 19 additions & 4 deletions build/ansible/roles/cloud-node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,26 @@
- yum-utils
- cloud-init
- firewalld
- python3-pip
- ansible
- 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
when: ansible_os_family == 'RedHat'
- name: Firewalld | Start EL9
when:
- ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux'
- ansible_distribution_major_version == '9'
- ansible_os_family == 'RedHat'
vars:
ansible_python_interpreter: /usr/bin/python3.9
service:
name: firewalld
state: started
Expand Down
15 changes: 13 additions & 2 deletions build/ansible/roles/pmm2-images/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,25 @@
state: installed
ignore_errors: True

- name: Packages | Update OS
- name: Packages | Update OS EL7
when:
- ansible_distribution == "CentOS"
- ansible_distribution_major_version == "7"
yum:
name: "*"
state: latest
exclude: "ansible*"
disablerepo: percona-release-x86_64

- name: Packages | Update OS EL9
when:
- ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux'
- ansible_distribution_major_version == '9'
yum:
name: "*"
state: latest
disablerepo: percona-release-x86_64

- name: Packages | Install OS tools for EL7
when:
- ansible_distribution == "CentOS"
Expand All @@ -70,7 +82,6 @@
name:
- python3-pip
- python3.11-pip
- python3.11
- python3.11-psycopg2
- rsync
- libsqlite3x-devel # package does not come pre-installed on EL9
Expand Down
21 changes: 8 additions & 13 deletions build/docker/server/Dockerfile.el9
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,14 @@ EXPOSE 80 443

WORKDIR /opt

# NOTE: Ansible should NOT be installed via yum/dnf
# Read more: https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#pip-install
# RUN microdnf -y install yum && yum -y install python3-pip && \
# yum -y install oracle-epel-release-el9 ansible-core && \
# python3 -m pip install ansible && \
# python3 -m pip install setuptools && \
# yum -y install epel-release

RUN microdnf -y install yum && yum -y install python3-pip && \
yum -y install oracle-epel-release-el9 ansible-core && \
yum -y install epel-release && \
yum -y install glibc-langpack-en && \
yum -y install ansible vi
RUN microdnf -y install epel-release && \
microdnf -y install ansible-core \
ansible-collection-community-general \
ansible-collection-community-postgresql \
ansible-collection-ansible-posix \
glibc-langpack-en \
yum \
vi

COPY RPMS /tmp/RPMS
COPY gitCommit /tmp/gitCommit
Expand Down
3 changes: 2 additions & 1 deletion build/packer/pmm2.el9.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
"inline": [
"sudo yum -y update",
"sudo yum -y install epel-release",
"sudo yum -y install ansible"
"sudo yum -y install ansible-core",
"sudo yum -y install ansible-collection-community-general ansible-collection-community-postgresql ansible-collection-ansible-posix"
]
},
{
Expand Down
42 changes: 40 additions & 2 deletions update/ansible/playbook/tasks/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,21 @@
- name: Wait for pmm-managed
pause: seconds=10

- name: Update system packages
- name: Update system packages EL7
when:
- ansible_distribution == "CentOS"
- ansible_distribution_major_version == "7"
yum:
name: "*"
state: latest
security: yes
exclude:
- nginx*

- name: Updating only select packages
- name: Updating only select packages EL7
when:
- ansible_distribution == "CentOS"
- ansible_distribution_major_version == "7"
yum:
name: "{{ item }}"
state: latest
Expand All @@ -258,6 +264,38 @@
- sshpass
- vi

- name: Remove ansible RPM if installed | EL9
when:
- ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux'
- ansible_distribution_major_version == '9'
yum:
name: ansible
state: absent
ignore_errors: yes

- name: Install ansible-core RPM | EL9
when:
- ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux'
- ansible_distribution_major_version == '9'
yum:
name:
- ansible-core
- ansible-collection-community-general
- ansible-collection-community-postgresql
- ansible-collection-ansible-posix
state: present

- name: Update system packages EL9
when:
- ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux'
- ansible_distribution_major_version == '9'
- not ansible_check_mode
yum:
name: "*"
state: latest
exclude:
- nginx*

- name: Install nginx
include_role:
name: nginx
Expand Down

0 comments on commit 576142a

Please sign in to comment.