Skip to content

Commit

Permalink
Fix molecule prepare playbooks (#129)
Browse files Browse the repository at this point in the history
Changes:

- Handle Rocky8 by renaming `roles/provision/tasks/RedHat9.yml` to
`roles/provision/tasks/RedHat.yml` and including when
`ansible_distribution_major_version` is not `7`.
- Fix all the broken `prepare.yml` playbooks used by `molecule`
- Changed triggers to run all tests on all PRs (closes #113)
  • Loading branch information
drmatthews authored Jul 18, 2024
1 parent b3bfedd commit 569ca7d
Show file tree
Hide file tree
Showing 26 changed files with 133 additions and 64 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/molecule-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ on:
pull_request:
paths:
- molecule_configs/*
- roles/docker/**
- playbooks/**
- roles/**
- .github/workflows/molecule-docker.yml
- "!**/README.md"

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-docker:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/molecule-firewalld.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ on:
pull_request:
paths:
- molecule_configs/*
- roles/firewalld/**
- playbooks/**
- roles/**
- .github/workflows/molecule-firewalld.yml
- "!**/README.md"

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-firewalld:
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/molecule-install-omero.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ name: Test install_omero playbook
on:
pull_request:
paths:
- roles/omero_server/**
- playbooks/install_omero.yml
- playbooks/molecule/**/omero/**
- molecule_configs/*
- playbooks/**
- roles/**
- .github/workflows/molecule-install-omero.yml
- "!**/README.md"
release:
types:
- published

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-install-omero:
runs-on: ubuntu-latest
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/molecule-install-xnat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@ on:
pull_request:
paths:
- molecule_configs/*
- roles/xnat/**
- roles/xnat_container_service/**
- playbooks/install_xnat.yml
- playbooks/molecule/**/xnat/**
- playbooks/**
- roles/**
- .github/workflows/molecule-install-xnat.yml
- "!**/README.md"
release:
types:
- published

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-install-xnat:
runs-on: ubuntu-latest
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/molecule-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ on:
pull_request:
paths:
- molecule_configs/*
- roles/install_java/**
- playbooks/**
- roles/**
- .github/workflows/molecule-java.yml
- "!**/README.md"

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-java:
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/molecule-monitoring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ on:
pull_request:
paths:
- molecule_configs/*
- roles/monitoring_client/**
- roles/monitoring_server/**
- playbooks/**
- roles/**
- .github/workflows/molecule-monitoring.yml
- "!**/README.md"

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-monitoring:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/molecule-nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ on:
pull_request:
paths:
- molecule_configs/*
- roles/nginx/**
- playbooks/**
- roles/**
- .github/workflows/molecule-nginx.yml
- "!**/README.md"

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-nginx:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/molecule-postgresql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ on:
pull_request:
paths:
- molecule_configs/*
- roles/postgresql/**
- playbooks/**
- roles/**
- .github/workflows/molecule-postgresql.yml
- "!**/README.md"

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-postgresql:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/molecule-postgresql_upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ on:
- molecule_configs/*
- roles/postgresql_upgrade/**
- .github/workflows/molecule-postgresql_upgrade.yml
- "!**/README.md"

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-postgresql-upgrade:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/molecule-provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ on:
pull_request:
paths:
- molecule_configs/*
- roles/provision/**
- playbooks/**
- roles/**
- .github/workflows/molecule-provision.yml
- "!**/README.md"

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-provision:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/molecule-provision_accounts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ on:
- roles/provision_accounts/**
- playbooks/setup_user_accounts.yml
- .github/workflows/molecule-provision_accounts.yml
- "!**/README.md"

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-provision-accounts:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/molecule-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ on:
pull_request:
paths:
- molecule_configs/*
- roles/install_python/**
- playbooks/**
- roles/**
- .github/workflows/molecule-python.yml
- "!**/README.md"

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-python:
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/molecule-tomcat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,15 @@ on:
pull_request:
paths:
- molecule_configs/*
- roles/tomcat/**
- playbooks/**
- roles/**
- .github/workflows/molecule-tomcat.yml
- "!**/README.md"

concurrency:
cancel-in-progress: true
group: >-
${{ github.workflow }}-${{ github.event.pull_request.number }}
jobs:
molecule-tomcat:
Expand Down
6 changes: 2 additions & 4 deletions playbooks/molecule/resources/monitoring/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
- name: Update YUM repo baseurls
ansible.builtin.include_role:
name: mirsg.infrastructure.provision
tasks_from: CentOS.yml
when:
ansible_facts['os_family'] == "RedHat" and
ansible_facts['distribution_major_version'] is version('7')
tasks_from: RedHat7.yml
when: ansible_facts['distribution_major_version'] is version('7')

- name: Install sudo
ansible.builtin.package:
Expand Down
6 changes: 2 additions & 4 deletions playbooks/molecule/resources/shared/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
- name: Update YUM repo baseurls
ansible.builtin.include_role:
name: mirsg.infrastructure.provision
tasks_from: CentOS.yml
when:
ansible_facts['os_family'] == "RedHat" and
ansible_facts['distribution_major_version'] is version('7')
tasks_from: RedHat7.yml
when: ansible_facts['distribution_major_version'] is version('7')

- name: Install sudo
ansible.builtin.package:
Expand Down
7 changes: 3 additions & 4 deletions roles/docker/molecule/resources/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
- name: Update YUM repo baseurls
ansible.builtin.include_role:
name: mirsg.infrastructure.provision
tasks_from: CentOS.yml
when:
ansible_facts['os_family'] == "RedHat" and
ansible_facts['distribution_major_version'] is version('7')
tasks_from: RedHat7.yml
when: ansible_facts['distribution_major_version'] is version('7')

- name: Install sudo
ansible.builtin.package:
name: sudo
Expand Down
6 changes: 2 additions & 4 deletions roles/firewalld/molecule/resources/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
- name: Update YUM repo baseurls
ansible.builtin.include_role:
name: mirsg.infrastructure.provision
tasks_from: CentOS.yml
when:
ansible_facts['os_family'] == "RedHat" and
ansible_facts['distribution_major_version'] is version('7')
tasks_from: RedHat7.yml
when: ansible_facts['distribution_major_version'] is version('7')

- name: Install sudo
ansible.builtin.package:
Expand Down
6 changes: 2 additions & 4 deletions roles/install_java/molecule/resources/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
- name: Update YUM repo baseurls
ansible.builtin.include_role:
name: mirsg.infrastructure.provision
tasks_from: CentOS.yml
when:
ansible_facts['os_family'] == "RedHat" and
ansible_facts['distribution_major_version'] is version('7')
tasks_from: RedHat7.yml
when: ansible_facts['distribution_major_version'] is version('7')

- name: Install sudo
ansible.builtin.package:
Expand Down
7 changes: 3 additions & 4 deletions roles/install_python/molecule/resources/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
- name: Update YUM repo baseurls
ansible.builtin.include_role:
name: mirsg.infrastructure.provision
tasks_from: CentOS.yml
when:
ansible_facts['os_family'] == "RedHat" and
ansible_facts['distribution_major_version'] is version('7')
tasks_from: RedHat7.yml
when: ansible_facts['distribution_major_version'] is version('7')

- name: Install sudo
ansible.builtin.package:
name: sudo
Expand Down
7 changes: 3 additions & 4 deletions roles/nginx/molecule/resources/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
- name: Update YUM repo baseurls
ansible.builtin.include_role:
name: mirsg.infrastructure.provision
tasks_from: CentOS.yml
when:
ansible_facts['os_family'] == "RedHat" and
ansible_facts['distribution_major_version'] is version('7')
tasks_from: RedHat7.yml
when: ansible_facts['distribution_major_version'] is version('7')

- name: Install sudo
ansible.builtin.package:
name: sudo
Expand Down
6 changes: 2 additions & 4 deletions roles/postgresql/molecule/resources/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
- name: Update YUM repo baseurls
ansible.builtin.include_role:
name: mirsg.infrastructure.provision
tasks_from: CentOS.yml
when:
ansible_facts['os_family'] == "RedHat" and
ansible_facts['distribution_major_version'] is version('7')
tasks_from: RedHat7.yml
when: ansible_facts['distribution_major_version'] is version('7')

- name: Install sudo
ansible.builtin.package:
Expand Down
6 changes: 2 additions & 4 deletions roles/postgresql_upgrade/molecule/resources/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
- name: Update YUM repo baseurls
ansible.builtin.include_role:
name: mirsg.infrastructure.provision
tasks_from: CentOS.yml
when:
ansible_facts['os_family'] == "RedHat" and
ansible_facts['distribution_major_version'] is version('7')
tasks_from: RedHat7.yml
when: ansible_facts['distribution_major_version'] is version('7')

- name: Install sudo
ansible.builtin.package:
Expand Down
File renamed without changes.
10 changes: 7 additions & 3 deletions roles/provision/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
ansible.builtin.include_tasks: check_mounts.yml
when: external_storage_drive is defined

- name: Set up for specific distribution
ansible.builtin.include_tasks:
RedHat{{ ansible_distribution_major_version }}.yml
- name: Set up for RedHat 7
ansible.builtin.include_tasks: RedHat7.yml
when: ansible_facts['distribution_major_version'] is version('7')

- name: Set up for RedHat > 7
ansible.builtin.include_tasks: RedHat.yml
when: ansible_facts['distribution_major_version'] is not version('7')

- name: Upgrade all packages # noqa: package-latest
ansible.builtin.yum:
Expand Down
6 changes: 2 additions & 4 deletions roles/provision_accounts/molecule/resources/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
- name: Update YUM repo baseurls
ansible.builtin.include_role:
name: mirsg.infrastructure.provision
tasks_from: CentOS.yml
when:
ansible_facts['os_family'] == "RedHat" and
ansible_facts['distribution_major_version'] is version('7')
tasks_from: RedHat7.yml
when: ansible_facts['distribution_major_version'] is version('7')

- name: Install sudo
ansible.builtin.package:
Expand Down
6 changes: 2 additions & 4 deletions roles/tomcat/molecule/resources/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
- name: Update YUM repo baseurls
ansible.builtin.include_role:
name: mirsg.infrastructure.provision
tasks_from: CentOS.yml
when:
ansible_facts['os_family'] == "RedHat" and
ansible_facts['distribution_major_version'] is version('7')
tasks_from: RedHat7.yml
when: ansible_facts['distribution_major_version'] is version('7')

- name: Install sudo
ansible.builtin.package:
Expand Down

0 comments on commit 569ca7d

Please sign in to comment.