From b1f52cbe58605306c3a25819dd8688175c055482 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 1 Sep 2023 09:02:04 +0200 Subject: [PATCH 01/12] run CI on a schedule --- .github/workflows/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1774ae2..3b6dd50 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,10 @@ name: CI -on: [push, pull_request] +on: + push: + pull_request: + schedule: + - cron: '0 6 * * *' env: COLORTERM: 'yes' From 0243922b134def672818ce7b067ae40b4f18054d Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 1 Sep 2023 09:05:37 +0200 Subject: [PATCH 02/12] disable var-naming[no-role-prefix] and force a var pattern instead --- .ansible-lint | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ansible-lint b/.ansible-lint index c9562df..0163c5f 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,3 +1,6 @@ --- enable_list: - only-builtins +skip_list: + - var-naming[no-role-prefix] +var_naming_pattern: "^(__)?foreman_[a-z_][a-z0-9_]*$" From 82c678d40661db4894e2ba5cc675f8f2028b8102 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 1 Sep 2023 09:21:19 +0200 Subject: [PATCH 03/12] make roles lint clean --- roles/cloud_connector/tasks/cleanup_receptor.yml | 6 +++--- roles/cloud_connector/tasks/delete_source.yml | 10 +++++----- roles/cloud_connector/tasks/main.yml | 8 ++++---- roles/foreman_repositories/tasks/redhat.yml | 8 ++++---- roles/installer/tasks/main.yml | 12 ++++++------ roles/postgresql_upgrade/tasks/main.yml | 12 ++++++------ roles/puppet_repositories/tasks/debian.yml | 4 ++-- 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/roles/cloud_connector/tasks/cleanup_receptor.yml b/roles/cloud_connector/tasks/cleanup_receptor.yml index 2969c08..3ef4b29 100644 --- a/roles/cloud_connector/tasks/cleanup_receptor.yml +++ b/roles/cloud_connector/tasks/cleanup_receptor.yml @@ -7,17 +7,17 @@ return_content: true validate_certs: true force_basic_auth: true - register: satellite_uuid_json + register: foreman_uuid_json - name: Find receptor configs ansible.builtin.find: paths: /etc/receptor file_type: directory - register: receptor_configs + register: __foreman_receptor_configs - name: Delete sources ansible.builtin.include_tasks: delete_source.yml - loop: "{{ receptor_configs['files'] }}" + loop: "{{ __foreman_receptor_configs['files'] }}" - name: Collect service facts ansible.builtin.service_facts: diff --git a/roles/cloud_connector/tasks/delete_source.yml b/roles/cloud_connector/tasks/delete_source.yml index ef82454..8d8be84 100644 --- a/roles/cloud_connector/tasks/delete_source.yml +++ b/roles/cloud_connector/tasks/delete_source.yml @@ -1,18 +1,18 @@ --- - name: Get source record ansible.builtin.uri: - url: "https://{{ foreman_cloud_connector_console_redhat_host }}/api/sources/v3.1/sources?filter[source_ref]={{ satellite_uuid_json.json.results[0].value }}" + url: "https://{{ foreman_cloud_connector_console_redhat_host }}/api/sources/v3.1/sources?filter[source_ref]={{ foreman_uuid_json.json.results[0].value }}" client_cert: "{{ item.path }}/cert.pem" client_key: "{{ item.path }}/key.pem" return_content: true - register: source_record_response + register: __foreman_source_record_response - name: Delete Source vars: - source_id: "{{ source_record_response.json.data[0].id }}" - when: "source_record_response.json.data | length == 1" + __foreman_source_id: "{{ __foreman_source_record_response.json.data[0].id }}" + when: "__foreman_source_record_response.json.data | length == 1" ansible.builtin.uri: - url: "https://{{ foreman_cloud_connector_console_redhat_host }}/api/sources/v3.1/sources/{{ source_id }}" + url: "https://{{ foreman_cloud_connector_console_redhat_host }}/api/sources/v3.1/sources/{{ __foreman_source_id }}" client_cert: "{{ item.path }}/cert.pem" client_key: "{{ item.path }}/key.pem" method: "DELETE" diff --git a/roles/cloud_connector/tasks/main.yml b/roles/cloud_connector/tasks/main.yml index cbe1f67..139360c 100644 --- a/roles/cloud_connector/tasks/main.yml +++ b/roles/cloud_connector/tasks/main.yml @@ -41,9 +41,9 @@ - name: Read client ID from CN of consumer ansible.builtin.command: openssl x509 -in /etc/pki/consumer/cert.pem -subject -noout - register: cert_output + register: __foreman_cert_output changed_when: false - when: cert_output is not defined + when: __foreman_cert_output is not defined - name: Set client ID in Satellite ansible.builtin.uri: @@ -52,13 +52,13 @@ password: "{{ foreman_cloud_connector_password }}" body: setting: - value: "{{ client_id }}" + value: "{{ __foreman_client_id }}" method: "PUT" validate_certs: "{{ foreman_cloud_connector_validate_certs }}" force_basic_auth: true body_format: json vars: - client_id: "{{ cert_output.stdout | regex_search('CN\\s?=\\s?([a-z0-9-]+)', '\\1') | first }}" + __foreman_client_id: "{{ __foreman_cert_output.stdout | regex_search('CN\\s?=\\s?([a-z0-9-]+)', '\\1') | first }}" - name: Configure HTTP proxy ansible.builtin.include_tasks: http_proxy.yml diff --git a/roles/foreman_repositories/tasks/redhat.yml b/roles/foreman_repositories/tasks/redhat.yml index 3d328ff..0471548 100644 --- a/roles/foreman_repositories/tasks/redhat.yml +++ b/roles/foreman_repositories/tasks/redhat.yml @@ -45,13 +45,13 @@ - name: Check if powertools repository is disabled ansible.builtin.command: dnf repolist --disabled powertools - register: disabled_repos + register: __foreman_disabled_repos changed_when: false - name: Enable powertools ansible.builtin.command: dnf config-manager --set-enabled powertools - register: dnf_set_enabled - changed_when: dnf_set_enabled.rc is defined and dnf_set_enabled.rc == '0' + register: __foreman_dnf_set_enabled + changed_when: __foreman_dnf_set_enabled.rc is defined and __foreman_dnf_set_enabled.rc == '0' when: - - "'powertools' in disabled_repos.stdout" + - "'powertools' in __foreman_disabled_repos.stdout" - ansible_distribution != 'RedHat' diff --git a/roles/installer/tasks/main.yml b/roles/installer/tasks/main.yml index d5b6aac..e9b5980 100644 --- a/roles/installer/tasks/main.yml +++ b/roles/installer/tasks/main.yml @@ -26,19 +26,19 @@ async: "{{ ansible_check_mode | ternary(0, foreman_installer_timeout) }}" # avoid connection timeouts changed_when: false # async always returns changed, check in async_status instead poll: 0 - register: async_results + register: __foreman_installer_async_results environment: LC_ALL: "{{ foreman_installer_locale }}" LANG: "{{ foreman_installer_locale }}" - name: Check async status for foreman-installer ansible.builtin.async_status: - jid: "{{ async_results.ansible_job_id }}" - register: async_poll_results - until: async_poll_results.finished - changed_when: async_poll_results.rc is defined and async_poll_results.rc == 2 + jid: "{{ __foreman_installer_async_results.ansible_job_id }}" + register: __foreman_installer_async_poll_results + until: __foreman_installer_async_poll_results.finished + changed_when: __foreman_installer_async_poll_results.rc is defined and __foreman_installer_async_poll_results.rc == 2 failed_when: - - (not async_poll_results.finished) or (async_poll_results.rc is defined and async_poll_results.rc not in [0, 2]) + - (not __foreman_installer_async_poll_results.finished) or (__foreman_installer_async_poll_results.rc is defined and __foreman_installer_async_poll_results.rc not in [0, 2]) retries: "{{ ((foreman_installer_timeout | int) / 5) | round | int }}" delay: 5 when: diff --git a/roles/postgresql_upgrade/tasks/main.yml b/roles/postgresql_upgrade/tasks/main.yml index 982c09e..f4e405e 100644 --- a/roles/postgresql_upgrade/tasks/main.yml +++ b/roles/postgresql_upgrade/tasks/main.yml @@ -9,11 +9,11 @@ - name: Get version from the PostgreSQL data directory ansible.builtin.slurp: path: /var/lib/pgsql/data/PG_VERSION - register: pg_version + register: __foreman_pg_version - name: Perform PostgreSQL upgrade when: - - "'10' in pg_version['content']|b64decode" + - "'10' in __foreman_pg_version['content']|b64decode" block: - name: Start postgresql ansible.builtin.service: @@ -27,12 +27,12 @@ become: true become_user: postgres changed_when: false - register: postgres_output + register: __foreman_postgres_output - name: Set collate and ctype facts ansible.builtin.set_fact: - collate: "{{ postgres_output.stdout.split('|')[3] | trim }}" - ctype: "{{ postgres_output.stdout.split('|')[4] | trim }}" + foreman_postgres_collate: "{{ __foreman_postgres_output.stdout.split('|')[3] | trim }}" + foreman_postgres_ctype: "{{ __foreman_postgres_output.stdout.split('|')[4] | trim }}" - name: Stop postgresql ansible.builtin.service: @@ -61,7 +61,7 @@ - name: Run postgresql-setup --upgrade # noqa no-changed-when ansible.builtin.command: postgresql-setup --upgrade environment: - PGSETUP_INITDB_OPTIONS: "--lc-collate={{ collate }} --lc-ctype={{ ctype }} --locale={{ collate }}" + PGSETUP_INITDB_OPTIONS: "--lc-collate={{ foreman_postgres_collate }} --lc-ctype={{ foreman_postgres_ctype }} --locale={{ foreman_postgres_collate }}" - name: Start postgresql ansible.builtin.service: diff --git a/roles/puppet_repositories/tasks/debian.yml b/roles/puppet_repositories/tasks/debian.yml index 56aab46..00c9ebd 100644 --- a/roles/puppet_repositories/tasks/debian.yml +++ b/roles/puppet_repositories/tasks/debian.yml @@ -9,12 +9,12 @@ ansible.builtin.apt: deb: "https://apt.puppet.com/puppet{{ foreman_puppet_repositories_version }}-release-{{ ansible_distribution_release }}.deb" state: present - register: puppet_apt_deb_install + register: __foreman_puppet_apt_deb_install - name: Update apt cache if necessary ansible.builtin.apt: update_cache: true force_apt_get: true - when: puppet_apt_deb_install.changed + when: __foreman_puppet_apt_deb_install.changed tags: - skip_ansible_lint # skip lint since we cannot use handler, and cache must be updated immediately From a55fe509e7bc928c50104676755193a3878cf50d Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 1 Sep 2023 09:11:28 +0200 Subject: [PATCH 04/12] make molecule plays also lint clean --- roles/backup/molecule/debian/verify.yml | 6 +++--- roles/backup/molecule/redhat/verify.yml | 6 +++--- .../molecule/default/verify.yml | 4 ++-- roles/foreman_repositories/molecule/debian/verify.yml | 6 +++--- roles/foreman_repositories/molecule/redhat/verify.yml | 4 ++-- roles/installer/molecule/default/verify.yml | 8 ++++---- roles/postgresql_upgrade/molecule/redhat/verify.yml | 6 +++--- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/roles/backup/molecule/debian/verify.yml b/roles/backup/molecule/debian/verify.yml index 04355ce..ae45960 100644 --- a/roles/backup/molecule/debian/verify.yml +++ b/roles/backup/molecule/debian/verify.yml @@ -6,11 +6,11 @@ - name: Get cronjob file ansible.builtin.slurp: path: /etc/cron.daily/foreman-backup - register: backupcron + register: __foreman_backupcron - name: Check foreman cronjob content ansible.builtin.assert: that: - - "'/var/backup/foreman' in crobjobcontent" + - "'/var/backup/foreman' in __foreman_crobjobcontent" vars: - crobjobcontent: "{{ backupcron['content'] | b64decode }}" + __foreman_crobjobcontent: "{{ __foreman_backupcron['content'] | b64decode }}" diff --git a/roles/backup/molecule/redhat/verify.yml b/roles/backup/molecule/redhat/verify.yml index 04355ce..ae45960 100644 --- a/roles/backup/molecule/redhat/verify.yml +++ b/roles/backup/molecule/redhat/verify.yml @@ -6,11 +6,11 @@ - name: Get cronjob file ansible.builtin.slurp: path: /etc/cron.daily/foreman-backup - register: backupcron + register: __foreman_backupcron - name: Check foreman cronjob content ansible.builtin.assert: that: - - "'/var/backup/foreman' in crobjobcontent" + - "'/var/backup/foreman' in __foreman_crobjobcontent" vars: - crobjobcontent: "{{ backupcron['content'] | b64decode }}" + __foreman_crobjobcontent: "{{ __foreman_backupcron['content'] | b64decode }}" diff --git a/roles/foreman_proxy_certs_generate/molecule/default/verify.yml b/roles/foreman_proxy_certs_generate/molecule/default/verify.yml index 1ef2cc1..d3caa3b 100644 --- a/roles/foreman_proxy_certs_generate/molecule/default/verify.yml +++ b/roles/foreman_proxy_certs_generate/molecule/default/verify.yml @@ -6,9 +6,9 @@ - name: Find proxy certs file ansible.builtin.stat: path: /root/proxy.example.com.tar.gz - register: cert_tarball + register: __foreman_cert_tarball - name: Check proxy certs file exists ansible.builtin.assert: that: - - cert_tarball.stat.exists + - __foreman_cert_tarball.stat.exists diff --git a/roles/foreman_repositories/molecule/debian/verify.yml b/roles/foreman_repositories/molecule/debian/verify.yml index 7c4d095..46428fe 100644 --- a/roles/foreman_repositories/molecule/debian/verify.yml +++ b/roles/foreman_repositories/molecule/debian/verify.yml @@ -6,10 +6,10 @@ - name: Get sources.list ansible.builtin.slurp: path: /etc/apt/sources.list.d/deb_theforeman_org.list - register: repos + register: __foreman_repos - name: Check Foreman repos exists ansible.builtin.assert: that: - - "'deb http://deb.theforeman.org bullseye 3.5' in repos['content'] | b64decode" - - "'deb http://deb.theforeman.org plugins 3.5' in repos['content'] | b64decode" + - "'deb http://deb.theforeman.org bullseye 3.5' in __foreman_repos['content'] | b64decode" + - "'deb http://deb.theforeman.org plugins 3.5' in __foreman_repos['content'] | b64decode" diff --git a/roles/foreman_repositories/molecule/redhat/verify.yml b/roles/foreman_repositories/molecule/redhat/verify.yml index b14326a..18c4172 100644 --- a/roles/foreman_repositories/molecule/redhat/verify.yml +++ b/roles/foreman_repositories/molecule/redhat/verify.yml @@ -36,9 +36,9 @@ - name: Stat katello.repo ansible.builtin.stat: path: /etc/yum.repos.d/katello.repo - register: katello_repo + register: foreman_katello_repo - name: Check katello_repo file exists ansible.builtin.assert: that: - - katello_repo.stat.exists + - foreman_katello_repo.stat.exists diff --git a/roles/installer/molecule/default/verify.yml b/roles/installer/molecule/default/verify.yml index 0f09e97..ba2c172 100644 --- a/roles/installer/molecule/default/verify.yml +++ b/roles/installer/molecule/default/verify.yml @@ -11,17 +11,17 @@ - name: Find installer flag file ansible.builtin.stat: path: /etc/foreman-installer/scenarios.d/.installed - register: installed_file + register: __foreman_installed_file - name: Assert installer flag file exists ansible.builtin.assert: that: - - installed_file.stat.exists + - __foreman_installed_file.stat.exists - name: Find tasks config file ansible.builtin.stat: path: /etc/foreman/plugins/foreman-tasks.yaml - register: foreman_tasks_yaml + register: __foreman_tasks_yaml - name: Check tasks config file exists ansible.builtin.assert: that: - - foreman_tasks_yaml.stat.exists + - __foreman_tasks_yaml.stat.exists diff --git a/roles/postgresql_upgrade/molecule/redhat/verify.yml b/roles/postgresql_upgrade/molecule/redhat/verify.yml index 8155ff0..44340b7 100644 --- a/roles/postgresql_upgrade/molecule/redhat/verify.yml +++ b/roles/postgresql_upgrade/molecule/redhat/verify.yml @@ -6,13 +6,13 @@ - name: Get version of postgres data directory ansible.builtin.slurp: path: /var/lib/pgsql/data/PG_VERSION - register: pg_version + register: __foreman_pg_version - name: Print PostgreSQL version ansible.builtin.debug: - msg: "{{ pg_version['content'] | b64decode }}" + msg: "{{ __foreman_pg_version['content'] | b64decode }}" - name: Assure postgresql version is 12 ansible.builtin.assert: that: - - "'12' in pg_version['content'] | b64decode" + - "'12' in __foreman_pg_version['content'] | b64decode" From 081974b2f428da59a8cb15c446a594d9f87a62c6 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 1 Sep 2023 09:33:11 +0200 Subject: [PATCH 05/12] update default Python versions for CI - run tests by default with 3.10, as core dropped 3.9 support in devel - add 3.9 as an additional test with core 2.11 - run all other steps with 3.11, as that's the latest supported one --- .github/workflows/docs.yml | 2 +- .github/workflows/main.yml | 17 +++++++++-------- .github/workflows/release.yml | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 17d8739..7dd0d63 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -21,7 +21,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: "3.11" - name: Install dependencies run: make doc-setup - name: Build docs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b6dd50..ba872fe 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: python: - - "3.9" + - "3.10" ansible: - stable-2.11 - stable-2.12 @@ -39,8 +39,8 @@ jobs: ansible: "stable-2.11" - python: "3.7" ansible: "stable-2.11" - - python: "3.10" - ansible: "devel" + - python: "3.9" + ansible: "stable-2.11" - python: "3.11" ansible: "devel" steps: @@ -68,7 +68,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: "3.11" cache: 'pip' cache-dependency-path: '**/requirements*.txt' - name: Install dependencies @@ -88,7 +88,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: "3.11" cache: 'pip' cache-dependency-path: '**/requirements*.txt' - name: Install dependencies @@ -109,9 +109,8 @@ jobs: fail-fast: false matrix: python: - - "3.9" + - "3.10" ansible: - - stable-2.11 - stable-2.12 - stable-2.13 - stable-2.14 @@ -122,6 +121,8 @@ jobs: ansible: "stable-2.9" - python: "3.8" ansible: "stable-2.10" + - python: "3.9" + ansible: "stable-2.11" steps: - uses: actions/checkout@v3 - name: Set up Python @@ -147,7 +148,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: "3.11" cache: 'pip' cache-dependency-path: '**/requirements*.txt' - name: Install dependencies diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fb95b51..2e330b7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.9" + python-version: "3.11" - name: Install Ansible run: pip install --upgrade ansible - name: Build Ansible Collection From 33b01a873fd235c783bdd24ab5917a69a409c989 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 1 Sep 2023 10:00:15 +0200 Subject: [PATCH 06/12] simplify test matrix - this collection does not contain any Python modules, so testing on different pythons is not *really* important - we run sanity only on 2.12+, so there is no point in seting up older versions of Ansible if there are no tests executed anyway - molecule based tests still run on Ansible 2.9+ to ensure support --- .github/workflows/main.yml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ba872fe..cfed1d6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,6 @@ jobs: python: - "3.10" ansible: - - stable-2.11 - stable-2.12 - stable-2.13 - stable-2.14 @@ -28,19 +27,9 @@ jobs: - devel include: - python: "3.8" - ansible: "stable-2.9" - - python: "3.8" - ansible: "stable-2.10" - - python: "2.7" - ansible: "stable-2.11" - - python: "3.5" - ansible: "stable-2.11" - - python: "3.6" - ansible: "stable-2.11" - - python: "3.7" - ansible: "stable-2.11" + ansible: "stable-2.12" - python: "3.9" - ansible: "stable-2.11" + ansible: "stable-2.13" - python: "3.11" ansible: "devel" steps: @@ -59,7 +48,6 @@ jobs: run: make test-setup - name: Run sanity tests run: make SANITY_OPTS="--local" sanity - if: matrix.ansible != 'stable-2.9' && matrix.ansible != 'stable-2.10' && matrix.ansible != 'stable-2.11' docs: runs-on: ubuntu-latest From fbba939f1534d8b9c58dfd49d51c27292af1ea81 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 1 Sep 2023 10:08:05 +0200 Subject: [PATCH 07/12] split galaxy-importer test into own job g-i pins old ansible-lint and that breaks stuff --- .github/workflows/main.yml | 15 +++++++++++++++ Makefile | 2 ++ requirements-lint.txt | 1 - 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cfed1d6..c556a93 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,6 +69,21 @@ jobs: name: docs-html path: docs/_build/html/ + galaxy-importer: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + cache: 'pip' + cache-dependency-path: '**/requirements*.txt' + - name: Install dependencies + run: pip install --upgrade py galaxy-importer + - name: Run galaxy-importer + run: make galaxy-importer + lint: runs-on: ubuntu-latest steps: diff --git a/Makefile b/Makefile index cc2baa0..ca9ba1d 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,8 @@ info: lint: $(MANIFEST) yamllint -f parsable roles ansible-lint -v roles/* + +galaxy-importer: $(MANIFEST) GALAXY_IMPORTER_CONFIG=tests/galaxy-importer.cfg python -m galaxy_importer.main $(NAMESPACE)-$(NAME)-$(VERSION).tar.gz sanity: $(MANIFEST) diff --git a/requirements-lint.txt b/requirements-lint.txt index 0f6df64..582cb9c 100644 --- a/requirements-lint.txt +++ b/requirements-lint.txt @@ -1,4 +1,3 @@ flake8<4 yamllint ansible-lint>=6.1.0 -galaxy-importer From b58b06a3d5db4460c4e9fcbe2e3f84500df8a0fe Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 1 Sep 2023 13:58:26 +0200 Subject: [PATCH 08/12] Release 2.1.0 --- CHANGELOG.rst | 3 +++ changelogs/changelog.yaml | 2 ++ galaxy.yml | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c27467c..e3073e6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,9 @@ theforeman.operations Release Notes .. contents:: Topics +v2.1.0 +====== + v2.0.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index d3b395e..2b744e5 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -79,3 +79,5 @@ releases: - bz2169682-world-inaccessible.yml - drop-ansible-repositories-role.yml release_date: '2023-05-08' + 2.1.0: + release_date: '2023-09-01' diff --git a/galaxy.yml b/galaxy.yml index 9b31cf3..5df7a39 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -12,7 +12,7 @@ authors: - "Matthias Dellweg <2500@gmx.de>" - "Robert Rettig " - "willtome " -version: "2.0.0" +version: "2.1.0" license: - "GPL-3.0-or-later" tags: From 93067321d064d62b50f5bf589e82f46dfe4c3462 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 1 Sep 2023 14:56:06 +0200 Subject: [PATCH 09/12] fix branding of variables --- .ansible-lint | 2 +- Makefile | 1 + roles/backup/molecule/satellite/verify.yml | 6 +++--- .../capsule_certs_generate/molecule/satellite/verify.yml | 4 ++-- roles/installer/molecule/satellite/verify.yml | 8 ++++---- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 0163c5f..1201f33 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -3,4 +3,4 @@ enable_list: - only-builtins skip_list: - var-naming[no-role-prefix] -var_naming_pattern: "^(__)?foreman_[a-z_][a-z0-9_]*$" +var_naming_pattern: "^(__)?satellite_[a-z_][a-z0-9_]*$" diff --git a/Makefile b/Makefile index 7d6bb43..aeceb60 100644 --- a/Makefile +++ b/Makefile @@ -112,6 +112,7 @@ branding: sed -i '/foreman_\w/ s/foreman_/satellite_/g' roles/*/README.md roles/*/*/*.yml roles/*/*/*.j2 sed -i 's/satellite_rh_cloud/foreman_rh_cloud/g' roles/*/README.md roles/*/*/*.yml roles/*/*/*.j2 sed -i 's/foreman-installer/satellite-installer/g' roles/*/README.md roles/*/*/*.yml + sed -i 's/foreman/satellite/' .ansible-lint rm -rf roles/puppet_repositories roles/foreman_repositories roles/postgresql_upgrade roles/ansible_repositories [ ! -d roles/foreman_proxy_certs_generate ] || mv roles/foreman_proxy_certs_generate roles/capsule_certs_generate rm -rf roles/*/molecule/default roles/*/molecule/debian roles/*/molecule/redhat diff --git a/roles/backup/molecule/satellite/verify.yml b/roles/backup/molecule/satellite/verify.yml index ae45960..eca0a29 100644 --- a/roles/backup/molecule/satellite/verify.yml +++ b/roles/backup/molecule/satellite/verify.yml @@ -6,11 +6,11 @@ - name: Get cronjob file ansible.builtin.slurp: path: /etc/cron.daily/foreman-backup - register: __foreman_backupcron + register: __satellite_backupcron - name: Check foreman cronjob content ansible.builtin.assert: that: - - "'/var/backup/foreman' in __foreman_crobjobcontent" + - "'/var/backup/foreman' in __satellite_crobjobcontent" vars: - __foreman_crobjobcontent: "{{ __foreman_backupcron['content'] | b64decode }}" + __satellite_crobjobcontent: "{{ __satellite_backupcron['content'] | b64decode }}" diff --git a/roles/capsule_certs_generate/molecule/satellite/verify.yml b/roles/capsule_certs_generate/molecule/satellite/verify.yml index d3caa3b..cf53fa3 100644 --- a/roles/capsule_certs_generate/molecule/satellite/verify.yml +++ b/roles/capsule_certs_generate/molecule/satellite/verify.yml @@ -6,9 +6,9 @@ - name: Find proxy certs file ansible.builtin.stat: path: /root/proxy.example.com.tar.gz - register: __foreman_cert_tarball + register: __satellite_cert_tarball - name: Check proxy certs file exists ansible.builtin.assert: that: - - __foreman_cert_tarball.stat.exists + - __satellite_cert_tarball.stat.exists diff --git a/roles/installer/molecule/satellite/verify.yml b/roles/installer/molecule/satellite/verify.yml index ba2c172..c582754 100644 --- a/roles/installer/molecule/satellite/verify.yml +++ b/roles/installer/molecule/satellite/verify.yml @@ -11,17 +11,17 @@ - name: Find installer flag file ansible.builtin.stat: path: /etc/foreman-installer/scenarios.d/.installed - register: __foreman_installed_file + register: __satellite_installed_file - name: Assert installer flag file exists ansible.builtin.assert: that: - - __foreman_installed_file.stat.exists + - __satellite_installed_file.stat.exists - name: Find tasks config file ansible.builtin.stat: path: /etc/foreman/plugins/foreman-tasks.yaml - register: __foreman_tasks_yaml + register: __satellite_tasks_yaml - name: Check tasks config file exists ansible.builtin.assert: that: - - __foreman_tasks_yaml.stat.exists + - __satellite_tasks_yaml.stat.exists From 8acfcd58c9dc4b5e485a81b98f35b39bb3051fbf Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 1 Sep 2023 15:04:25 +0200 Subject: [PATCH 10/12] lint fixes for fake_installer_rpm role --- roles/fake_installer_rpm/defaults/main.yml | 2 +- .../molecule/satellite/prepare.yml | 8 ++++---- .../fake_installer_rpm/molecule/satellite/verify.yml | 12 ++++++------ roles/fake_installer_rpm/tasks/main.yml | 11 +++++------ 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/roles/fake_installer_rpm/defaults/main.yml b/roles/fake_installer_rpm/defaults/main.yml index c058a62..0742f50 100644 --- a/roles/fake_installer_rpm/defaults/main.yml +++ b/roles/fake_installer_rpm/defaults/main.yml @@ -1,2 +1,2 @@ --- -fake_installer_rpm_repo: "/tmp/fake-installer-repo" +satellite_fake_installer_rpm_repo: "/tmp/fake-installer-repo" diff --git a/roles/fake_installer_rpm/molecule/satellite/prepare.yml b/roles/fake_installer_rpm/molecule/satellite/prepare.yml index 468719c..a6956c2 100644 --- a/roles/fake_installer_rpm/molecule/satellite/prepare.yml +++ b/roles/fake_installer_rpm/molecule/satellite/prepare.yml @@ -3,9 +3,9 @@ hosts: all gather_facts: true become: true - vars: - foreman_repositories_version: "2.4" - foreman_repositories_katello_version: "4.0" roles: - - theforeman.operations.puppet_repositories + - role: theforeman.operations.puppet_repositories + vars: + foreman_repositories_version: "2.4" + foreman_repositories_katello_version: "4.0" - theforeman.operations.foreman_repositories diff --git a/roles/fake_installer_rpm/molecule/satellite/verify.yml b/roles/fake_installer_rpm/molecule/satellite/verify.yml index 4a59b0a..2e759bc 100644 --- a/roles/fake_installer_rpm/molecule/satellite/verify.yml +++ b/roles/fake_installer_rpm/molecule/satellite/verify.yml @@ -3,18 +3,18 @@ hosts: all gather_facts: false tasks: - - name: satellite-installer RPM can be installed - package: + - name: Install satellite-installer RPM + ansible.builtin.package: name: satellite-installer state: present - - name: find satellite-installer symlink - stat: + - name: Find satellite-installer symlink + ansible.builtin.stat: path: /usr/sbin/satellite-installer register: satellite_installer - - name: check satellite-installer symlink exists - assert: + - name: Check satellite-installer symlink exists + ansible.builtin.assert: that: - satellite_installer.stat.exists - satellite_installer.stat.islnk diff --git a/roles/fake_installer_rpm/tasks/main.yml b/roles/fake_installer_rpm/tasks/main.yml index 8cce3fc..05a913e 100644 --- a/roles/fake_installer_rpm/tasks/main.yml +++ b/roles/fake_installer_rpm/tasks/main.yml @@ -15,13 +15,12 @@ ansible.builtin.template: src: satellite-installer.spec.j2 dest: "{{ ansible_env.HOME }}/rpmbuild/SPECS/satellite-installer.spec" - mode: 0644 + mode: '0644' - name: Build satellite-installer RPM ansible.builtin.shell: "rpmbuild -ba SPECS/satellite-installer.spec" # noqa command-instead-of-shell args: chdir: "{{ ansible_env.HOME }}/rpmbuild" - register: build_result changed_when: true tags: - molecule-idempotence-notest @@ -29,14 +28,14 @@ - name: Copy satellite-installer RPM to local repo ansible.builtin.copy: src: "{{ ansible_env.HOME }}/rpmbuild/RPMS/x86_64/" - dest: "{{ fake_installer_rpm_repo }}" + dest: "{{ satellite_fake_installer_rpm_repo }}" remote_src: true - mode: 0644 + mode: '0644' tags: - molecule-idempotence-notest - name: Create a local repository - ansible.builtin.command: "createrepo --update {{ fake_installer_rpm_repo }}" + ansible.builtin.command: "createrepo --update {{ satellite_fake_installer_rpm_repo }}" changed_when: true tags: - molecule-idempotence-notest @@ -45,6 +44,6 @@ ansible.builtin.yum_repository: name: fake-installer-rpm description: Local repository for satellite-installer fake RPM - baseurl: "file://{{ fake_installer_rpm_repo }}" + baseurl: "file://{{ satellite_fake_installer_rpm_repo }}" enabled: true gpgcheck: false From 769606065ffd9238d89bb0e0d7fd2cac425aa9dc Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 1 Sep 2023 15:10:21 +0200 Subject: [PATCH 11/12] make molecule prepare plays lint clean --- .../capsule_certs_generate/molecule/satellite/prepare.yml | 8 ++++---- roles/fake_installer_rpm/molecule/satellite/prepare.yml | 4 ++-- roles/installer/molecule/satellite/prepare.yml | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/roles/capsule_certs_generate/molecule/satellite/prepare.yml b/roles/capsule_certs_generate/molecule/satellite/prepare.yml index 2b9cd61..e6ed64c 100644 --- a/roles/capsule_certs_generate/molecule/satellite/prepare.yml +++ b/roles/capsule_certs_generate/molecule/satellite/prepare.yml @@ -3,11 +3,11 @@ hosts: all gather_facts: true become: true - vars: - foreman_repositories_version: "3.1" - foreman_repositories_katello_version: "4.3" roles: - - theforeman.operations.foreman_repositories + - role: theforeman.operations.foreman_repositories + vars: + foreman_repositories_version: "3.1" + foreman_repositories_katello_version: "4.3" - theforeman.operations.puppet_repositories - fake_installer_rpm post_tasks: diff --git a/roles/fake_installer_rpm/molecule/satellite/prepare.yml b/roles/fake_installer_rpm/molecule/satellite/prepare.yml index a6956c2..e0c1445 100644 --- a/roles/fake_installer_rpm/molecule/satellite/prepare.yml +++ b/roles/fake_installer_rpm/molecule/satellite/prepare.yml @@ -4,8 +4,8 @@ gather_facts: true become: true roles: - - role: theforeman.operations.puppet_repositories + - theforeman.operations.puppet_repositories + - role: theforeman.operations.foreman_repositories vars: foreman_repositories_version: "2.4" foreman_repositories_katello_version: "4.0" - - theforeman.operations.foreman_repositories diff --git a/roles/installer/molecule/satellite/prepare.yml b/roles/installer/molecule/satellite/prepare.yml index 281a0de..53e916a 100644 --- a/roles/installer/molecule/satellite/prepare.yml +++ b/roles/installer/molecule/satellite/prepare.yml @@ -3,12 +3,12 @@ hosts: all gather_facts: true become: true - vars: - foreman_repositories_version: "3.2" - foreman_repositories_katello_version: "4.4" roles: - theforeman.operations.puppet_repositories - - theforeman.operations.foreman_repositories + - role: theforeman.operations.foreman_repositories + vars: + foreman_repositories_version: "3.2" + foreman_repositories_katello_version: "4.4" - fake_installer_rpm tasks: - name: Ensure langpacks on EL8 From cbfc27e9cb09444dc596c60785ec5916a1ea1e0f Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 1 Sep 2023 15:20:29 +0200 Subject: [PATCH 12/12] fix branding of result tarball in ci --- .github/workflows/main.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 67cd997..683cc34 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,7 +106,7 @@ jobs: uses: actions/upload-artifact@v3 with: name: collection - path: theforeman-operations-*.tar.gz + path: redhat-satellite_operations-*.tar.gz molecule: runs-on: ubuntu-20.04 diff --git a/Makefile b/Makefile index aeceb60..3dd8329 100644 --- a/Makefile +++ b/Makefile @@ -103,7 +103,7 @@ branding: sed -i 's/foreman.example.com/satellite.example.com/g' roles/*/README.md roles/*/*/*.yml sed -i 's/katello/satellite/g' roles/*/README.md roles/*/*/*.yml sed -i 's#theforeman/foreman-operations-collection#RedHatSatellite/satellite-operations-collection#g' .github/workflows/*.yml - sed -i 's/theforeman-foreman/redhat-satellite-operations/g' .github/workflows/*.yml + sed -i 's/theforeman-operations/redhat-satellite_operations/g' .github/workflows/*.yml sed -i 's/Foreman Operations Collection/Red Hat Satellite Operations Collection/g' docs/index.rst docs/conf.py sed -i 's/The Foreman Project/Red Hat, Inc./g' docs/conf.py sed -i 's/Foreman/Satellite/g' roles/*/README.md roles/*/*/*.yml