Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions VERSIONS
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ REPO_VER="1.0-25"
PS_INN_LTS_VER="9.2.0-1"
PS_INN_LTS_REV="f02c4125"
PS_INN_LTS_REPO="ps-9x-innovation"
PXB_INN_LTS_VER="8.3.0-1"
PXB_INN_LTS_VER="9.1.0"
PXB_INN_LTS_REV="fcee26ff"
PXB_INN_LTS_REPO="pxb-8x-innovation"
PXB_INN_LTS_MAJ_VER="8.3.0"
PXB_INN_LTS_MAJ_VER="9.1.0"
PXB_INN_LTS_PKG_VER="1"
PXC_INN_LTS_VER="9.2.0-1"
PXC_INN_LTS_INNODB="1"
Expand Down
38 changes: 38 additions & 0 deletions molecule/pxb-9x-testing/molecule/ubuntu-jammy/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
dependency:
name: galaxy
driver:
name: ec2
platforms:
- name: ujammy-${BUILD_NUMBER}-${JOB_NAME}-${PLAYBOOK_VAR}
region: us-west-2
image: ami-0ee8244746ec5d6d4
vpc_subnet_id: subnet-03136d8c244f56036
instance_type: t2.medium
ssh_user: ubuntu
root_device_name: /dev/sda1
instance_tags:
iit-billing-tag: pxb-9x-testing
job-name: ${JOB_NAME}
provisioner:
name: ansible
log: True
playbooks:
create: ../../playbooks/create_noble.yml
# destroy: ../../playbooks/destroy_noble.yml
prepare: ../../playbooks/prepare.yml
cleanup: ../../playbooks/cleanup.yml
converge: ../../../../playbooks/pxb_9x.yml
scenario:
name: ubuntu-jammy
# destroy_sequence:
# - destroy
cleanup_sequence:
- cleanup
test_sequence:
# - destroy
- create
- prepare
- converge
- cleanup
# - destroy
102 changes: 102 additions & 0 deletions molecule/pxb-9x-testing/playbooks/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
- name: Cleanup
hosts: all
become: true
become_method: sudo
vars:
WORKSPACE_VAR: "{{ lookup('env', 'WORKSPACE_VAR') }}"
tasks:
- name: PRINT WORKSPACE_VAR
debug:
msg: "WORKSPACE_VAR: {{ WORKSPACE_VAR }}"

- name: Check if mysqld.log exists
stat:
path: /var/log/mysqld.log
register: mysqld_log

- name: Check if mysql error log exists
stat:
path: /var/log/mysql/error.log
register: mysql_error_log

- name: Create a temporary directory for zipping logs
file:
path: /var/tmp/mysql_logs
state: directory
mode: '0755'
when:
- mysqld_log.stat.exists or mysql_error_log.stat.exists

- name: Copy mysqld.log to temporary directory if it exists
shell: cp /var/log/mysqld.log /var/tmp/mysql_logs/mysqld.log
when: mysqld_log.stat.exists

- name: Copy mysql error log to temporary directory if it exists
shell: cp /var/log/mysql/error.log /var/tmp/mysql_logs/error.log
when: mysql_error_log.stat.exists

- name: Zip the log files if any exist
archive:
path: /var/tmp/mysql_logs
dest: /var/tmp/mysql_logs.zip
format: zip
when:
- mysqld_log.stat.exists or mysql_error_log.stat.exists
##

- name: Get the arch value from /etc/os-release
shell: uname -m
register: arch_output

- name: Replace spaces with dashes in arch_output
set_fact:
arch_output: "{{ arch_output.stdout | trim }}"

##
- name: Get the PRETTY_NAME value from /etc/os-release
shell: |
grep '^PRETTY_NAME=' /etc/os-release | cut -d'=' -f2 | tr -d '"'
register: pretty_name_output

- name: Replace spaces with dashes in PRETTY_NAME
set_fact:
os_id: "{{ pretty_name_output.stdout | replace(' ', '-') | trim }}"

- name: Debug the arch_output
debug:
msg: "The arch_output is {{ arch_output }}"

- name: Debug the OS ID
debug:
msg: "The OS ID is {{ os_id }}"

- name: Fetch the logs archive on localhost
fetch:
src: /var/tmp/mysql_logs.zip
dest: "/{{ WORKSPACE_VAR }}/{{ ansible_hostname }}_{{ os_id }}_{{ arch_output }}_mysql_logs.zip"
flat: yes
become: true

- name: Debug the fetch task status on localhost
command: ls -l "/{{ WORKSPACE_VAR }}"
register: fetch_list
delegate_to: localhost

- name: Debug the list of files in /{{ WORKSPACE_VAR }} on localhost
debug:
msg: "Files in /{{ WORKSPACE_VAR }}: {{ fetch_list.stdout_lines }}"
delegate_to: localhost

- name: remove Tarball directories
file:
path: "{{ paths }}"
state: absent
vars:
paths:
- /tmp/percona-server-{{ lookup('env', 'PS_VERSION') }}.tar.gz
- /tmp/percona-server-{{ lookup('env', 'PS_VERSION') }}-minimal.tar.gz
- /tmp/percona-server-{{ lookup('env', 'PS_VERSION') }}-debug.tar.gz
- /usr/percona-server
- /tmp/percona-server-minimal
- /tmp/percona-server-debug
Loading