From fae14df90cf3c4e2d624806a365c69d6b6b93c38 Mon Sep 17 00:00:00 2001 From: Oleksandr Havryliak Date: Mon, 2 Dec 2024 17:57:30 +0200 Subject: [PATCH 1/2] PSMDB fix roles and playbooks for AL --- playbooks/prepare.yml | 9 +++++++ .../molecule/docker/molecule.yml | 4 +-- .../psmdb-tarball/playbooks/prepare.yml | 25 +++++++++++++++++++ psmdb/psmdb/molecule/docker/molecule.yml | 4 +-- roles/kerberos/tasks/main.yml | 2 +- roles/kmip/tasks/RedHat.yml | 10 ++++---- roles/openldap/tasks/RedHat.yml | 10 ++++++++ roles/openldap/tasks/main.yml | 2 +- roles/vault/tasks/RedHat.yml | 22 ++++++++++------ 9 files changed, 70 insertions(+), 18 deletions(-) diff --git a/playbooks/prepare.yml b/playbooks/prepare.yml index 9e9fc5c5..80a760d3 100644 --- a/playbooks/prepare.yml +++ b/playbooks/prepare.yml @@ -139,3 +139,12 @@ - git - wget when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 8 + + - name: Install necessary tools for AL + yum: + name: "{{ packages }}" + vars: + packages: + - iproute + - openssl + when: ansible_distribution == "Amazon" diff --git a/psmdb-tarball/psmdb-tarball/molecule/docker/molecule.yml b/psmdb-tarball/psmdb-tarball/molecule/docker/molecule.yml index 6c93f986..19f8c712 100644 --- a/psmdb-tarball/psmdb-tarball/molecule/docker/molecule.yml +++ b/psmdb-tarball/psmdb-tarball/molecule/docker/molecule.yml @@ -4,8 +4,8 @@ dependency: driver: name: docker platforms: - - name: ${MOLECULE_OS:-ubuntu2204} - image: "${MOLECULE_DISTRO:-geerlingguy/docker-ubuntu2204-ansible:latest}" + - name: ${MOLECULE_OS:-amazonlinux2023} + image: "${MOLECULE_DISTRO:-geerlingguy/docker-amazonlinux2023-ansible:latest}" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw diff --git a/psmdb-tarball/psmdb-tarball/playbooks/prepare.yml b/psmdb-tarball/psmdb-tarball/playbooks/prepare.yml index bb5b7684..a09d4f8c 100644 --- a/psmdb-tarball/psmdb-tarball/playbooks/prepare.yml +++ b/psmdb-tarball/psmdb-tarball/playbooks/prepare.yml @@ -83,6 +83,31 @@ - unzip when: ansible_os_family == "RedHat" and ansible_distribution_major_version >= "8" + - name: install necessary rpm packages for AL + yum: + name: "{{ packages }}" + state: latest + vars: + packages: + - iproute + - tar + - bzip2-devel + - bzip2-libs + - gcc + - gcc-c++ + - git + - make + - openssl-devel + - zlib-devel + - python3-pip + - python3-devel + - python3-ldap + - psmisc + - libffi-devel + - xz-devel + - unzip + when: ansible_distribution == "Amazon" + - name: install necessary rpm packages for RHEL9 yum: name: "{{ packages }}" diff --git a/psmdb/psmdb/molecule/docker/molecule.yml b/psmdb/psmdb/molecule/docker/molecule.yml index b09de555..d537c178 100644 --- a/psmdb/psmdb/molecule/docker/molecule.yml +++ b/psmdb/psmdb/molecule/docker/molecule.yml @@ -4,8 +4,8 @@ dependency: driver: name: docker platforms: - - name: ${MOLECULE_OS:-ubuntu2204} - image: "${MOLECULE_DISTRO:-geerlingguy/docker-ubuntu2204-ansible:latest}" + - name: ${MOLECULE_OS:-amazonlinux2023} + image: "${MOLECULE_DISTRO:-geerlingguy/docker-amazonlinux2023-ansible:latest}" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw diff --git a/roles/kerberos/tasks/main.yml b/roles/kerberos/tasks/main.yml index 5fe14d37..372ad05b 100644 --- a/roles/kerberos/tasks/main.yml +++ b/roles/kerberos/tasks/main.yml @@ -1,7 +1,7 @@ --- -- name: Install necessary tools for Debain +- name: Install necessary tools for Debian apt: name: "{{ packages }}" update_cache: yes diff --git a/roles/kmip/tasks/RedHat.yml b/roles/kmip/tasks/RedHat.yml index 3519b248..071ad76a 100644 --- a/roles/kmip/tasks/RedHat.yml +++ b/roles/kmip/tasks/RedHat.yml @@ -23,7 +23,7 @@ - git - python3-pip - python3-sqlalchemy - when: ansible_distribution_major_version >= "8" + when: ansible_distribution_major_version|int >= 8 - name: Install python2 enum pip: @@ -39,17 +39,17 @@ - setuptools<71.0.0 state: present executable: pip3 - when: ansible_distribution_major_version > "8" + when: ansible_distribution_major_version|int >= 8 - name: Debug python3 version RHEL8 shell: "python3 --version" register: python_version - when: ansible_distribution_major_version >= "8" + when: ansible_distribution_major_version|int >= 8 - name: Display python version debug: var: python_version.stdout - when: ansible_distribution_major_version >= "8" + when: ansible_distribution_major_version|int >= 8 - name: Install python3 setuptools pip: @@ -73,4 +73,4 @@ dest: /usr/bin/python state: link force: yes - when: ansible_distribution_major_version > "7" + when: ansible_distribution_major_version|int >= 8 diff --git a/roles/openldap/tasks/RedHat.yml b/roles/openldap/tasks/RedHat.yml index ddb1431f..6168f3b4 100644 --- a/roles/openldap/tasks/RedHat.yml +++ b/roles/openldap/tasks/RedHat.yml @@ -76,3 +76,13 @@ - openldap-servers - openldap-clients when: ansible_distribution_major_version == "9" + +- name: Install required packages + yum: + state: present + name: + - openldap + - openldap-devel + - openldap-servers + - openldap-clients + when: ansible_distribution == "Amazon" diff --git a/roles/openldap/tasks/main.yml b/roles/openldap/tasks/main.yml index f28be4a4..f39b61c3 100644 --- a/roles/openldap/tasks/main.yml +++ b/roles/openldap/tasks/main.yml @@ -5,7 +5,7 @@ - include_vars: "RedHat-vars.yml" when: ansible_os_family == "RedHat" and ansible_distribution_major_version <= "7" - include_vars: "RedHat8-vars.yml" - when: ansible_os_family == "RedHat" and ansible_distribution_major_version >= "8" + when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 8 - include_tasks: "{{ansible_os_family}}.yml" - name: Start ldap service diff --git a/roles/vault/tasks/RedHat.yml b/roles/vault/tasks/RedHat.yml index 2011f8a5..a035cf92 100644 --- a/roles/vault/tasks/RedHat.yml +++ b/roles/vault/tasks/RedHat.yml @@ -4,21 +4,29 @@ state: present - name: Add HashiCorp yum repo - command: yum-config-manager --add-repo=https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo + command: yum-config-manager --add-repo=https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo args: creates: /etc/yum.repos.d/hashicorp.repo - when: ansible_distribution_major_version > "7" + when: ansible_distribution == "Amazon" -- name: Fix Hashicorp yum repo - shell: | - sed 's/\$releasever/{{ ansible_distribution_major_version }}/g' -i /etc/yum.repos.d/hashicorp.repo - when: ansible_distribution_major_version > "7" +- block: + - name: Add HashiCorp yum repo + command: yum-config-manager --add-repo=https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo + args: + creates: /etc/yum.repos.d/hashicorp.repo + when: ansible_distribution_major_version|int >= 8 + + - name: Fix Hashicorp yum repo + shell: | + sed 's/\$releasever/{{ ansible_distribution_major_version }}/g' -i /etc/yum.repos.d/hashicorp.repo + when: ansible_distribution_major_version|int >= 8 + when: ansible_distribution != "Amazon" - name: Install Vault via yum yum: name: vault state: present - when: ansible_distribution_major_version > "7" + when: ansible_distribution_major_version|int >= 8 - name: Install Vault for Centos7 from archive yum: name=https://archive.releases.hashicorp.com/RHEL/7/x86_64/stable/vault-1.17.2-1.x86_64.rpm state=present From 5531282d9a0eb5b6046f55ed8572412688520212 Mon Sep 17 00:00:00 2001 From: Oleksandr Havryliak Date: Tue, 3 Dec 2024 10:26:45 +0200 Subject: [PATCH 2/2] PSMDB add AL2023 amis --- playbooks/prepare.yml | 1 + psmdb/psmdb/molecule/al2023-arm/molecule.yml | 51 ++++++++++++++++++++ psmdb/psmdb/molecule/al2023/molecule.yml | 51 ++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 psmdb/psmdb/molecule/al2023-arm/molecule.yml create mode 100644 psmdb/psmdb/molecule/al2023/molecule.yml diff --git a/playbooks/prepare.yml b/playbooks/prepare.yml index 80a760d3..acb9b8f4 100644 --- a/playbooks/prepare.yml +++ b/playbooks/prepare.yml @@ -145,6 +145,7 @@ name: "{{ packages }}" vars: packages: + - tar - iproute - openssl when: ansible_distribution == "Amazon" diff --git a/psmdb/psmdb/molecule/al2023-arm/molecule.yml b/psmdb/psmdb/molecule/al2023-arm/molecule.yml new file mode 100644 index 00000000..e5852ee9 --- /dev/null +++ b/psmdb/psmdb/molecule/al2023-arm/molecule.yml @@ -0,0 +1,51 @@ +--- +dependency: + name: galaxy +driver: + name: ec2 +platforms: + - name: al2023-arm-${BUILD_NUMBER}-${JOB_NAME} + region: us-west-2 + image: ami-01167b661200e49e7 + vpc_subnet_id: subnet-03136d8c244f56036 + instance_type: c6g.large + ssh_user: ec2-user + root_device_name: /dev/sda1 + instance_tags: + iit-billing-tag: jenkins-psmdb-worker + job-name: ${JOB_NAME} +provisioner: + name: ansible + log: True + playbooks: + create: ../../../../playbooks/create.yml + destroy: ../../../../playbooks/destroy.yml + prepare: ../../../../playbooks/prepare.yml + cleanup: ../../playbooks/cleanup.yml + converge: ../../playbooks/playbook.yml +verifier: + name: testinfra + directory: ../../../tests/ + additional_files_or_dirs: + - ../psmdb/tests/ + options: + verbose: true + s: true + junitxml: al2023-arm-report.xml +scenario: + name: al2023-arm + converge_sequence: + - prepare + - converge + destroy_sequence: + - destroy + clenup_sequence: + - cleanup + test_sequence: + - destroy + - create + - prepare + - converge + - verify + - cleanup + - destroy diff --git a/psmdb/psmdb/molecule/al2023/molecule.yml b/psmdb/psmdb/molecule/al2023/molecule.yml new file mode 100644 index 00000000..b949118d --- /dev/null +++ b/psmdb/psmdb/molecule/al2023/molecule.yml @@ -0,0 +1,51 @@ +--- +dependency: + name: galaxy +driver: + name: ec2 +platforms: + - name: al2023-${BUILD_NUMBER}-${JOB_NAME} + region: us-west-2 + image: ami-055e3d4f0bbeb5878 + vpc_subnet_id: subnet-03136d8c244f56036 + instance_type: t3.small + ssh_user: ec2-user + root_device_name: /dev/sda1 + instance_tags: + iit-billing-tag: jenkins-psmdb-worker + job-name: ${JOB_NAME} +provisioner: + name: ansible + log: True + playbooks: + create: ../../../../playbooks/create.yml + destroy: ../../../../playbooks/destroy.yml + prepare: ../../../../playbooks/prepare.yml + cleanup: ../../playbooks/cleanup.yml + converge: ../../playbooks/playbook.yml +verifier: + name: testinfra + directory: ../../../tests/ + additional_files_or_dirs: + - ../psmdb/tests/ + options: + verbose: true + s: true + junitxml: al2023-report.xml +scenario: + name: al2023 + converge_sequence: + - prepare + - converge + destroy_sequence: + - destroy + clenup_sequence: + - cleanup + test_sequence: + - destroy + - create + - prepare + - converge + - verify + - cleanup + - destroy