From 92b1ff45f44979803a7096f5657d0f7941255e0d Mon Sep 17 00:00:00 2001 From: sean-m-sullivan Date: Tue, 17 Jan 2023 17:50:24 -0500 Subject: [PATCH 1/8] update --- .github/tests/build_ee.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/tests/build_ee.yml b/.github/tests/build_ee.yml index 1e6b414..2ff6668 100644 --- a/.github/tests/build_ee.yml +++ b/.github/tests/build_ee.yml @@ -1,8 +1,15 @@ --- - name: Playbook to configure execution environments +<<<<<<< HEAD hosts: localhost connection: local gather_facts: false +======= + hosts: builder + gather_facts: false + # vars_files: + # - "../vaults/{{ env }}.yml" +>>>>>>> 0968e52 (update release and testing) pre_tasks: - name: Validate that ansible-builder is installed on target system block: From 9373b90608d8421f1c1d6780014e8a61c95c896a Mon Sep 17 00:00:00 2001 From: sean-m-sullivan Date: Tue, 17 Jan 2023 17:52:25 -0500 Subject: [PATCH 2/8] update --- .github/tests/build_ee.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/tests/build_ee.yml b/.github/tests/build_ee.yml index 2ff6668..1e6b414 100644 --- a/.github/tests/build_ee.yml +++ b/.github/tests/build_ee.yml @@ -1,15 +1,8 @@ --- - name: Playbook to configure execution environments -<<<<<<< HEAD hosts: localhost connection: local gather_facts: false -======= - hosts: builder - gather_facts: false - # vars_files: - # - "../vaults/{{ env }}.yml" ->>>>>>> 0968e52 (update release and testing) pre_tasks: - name: Validate that ansible-builder is installed on target system block: From 63e9c2887b3596926e8d10b1262000dd9979cf30 Mon Sep 17 00:00:00 2001 From: sean-m-sullivan Date: Tue, 24 Jan 2023 22:16:18 -0500 Subject: [PATCH 3/8] update tests and fix ci --- .ansible-lint | 3 +- .github/tests/ee_builder.yaml | 4 +- .github/workflows/ci_testing.yaml | 2 +- roles/ee_builder/README.md | 2 + roles/virtualenv_migrate/tasks/01_ee_diff.yml | 40 +++++++++---------- 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index d349bd4..c7de0e1 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -13,7 +13,8 @@ use_default_rules: true # https://github.com/ansible/ansible-lint/issues/808 # with verbosity set to 1, its dumping 'unknown file type messages' # verbosity: 1 -skip_list: [] +skip_list: + - meta-unsupported-ansible kinds: - playbooks: "**/examples/*.{yml,yaml}" - tasks: "**/examples/tasks/*.yml" diff --git a/.github/tests/ee_builder.yaml b/.github/tests/ee_builder.yaml index f1d7927..286f3b3 100644 --- a/.github/tests/ee_builder.yaml +++ b/.github/tests/ee_builder.yaml @@ -13,8 +13,8 @@ ee_list: - name: custom_ee alt_name: Custom EE - ee_base_image: 1registry.redhat.io/ansible-automation-platform-23/ee-supported-rhel8:latest - ee_builder_image: 1registry.redhat.io/ansible-automation-platform-23/ansible-builder-rhel8:latest + ee_base_image: registry.redhat.io/ansible-automation-platform-23/ee-supported-rhel8:latest + ee_builder_image: registry.redhat.io/ansible-automation-platform-23/ansible-builder-rhel8:latest tag: 1-11-21-2 # base_image bindep: diff --git a/.github/workflows/ci_testing.yaml b/.github/workflows/ci_testing.yaml index 1f178e9..435bed4 100644 --- a/.github/workflows/ci_testing.yaml +++ b/.github/workflows/ci_testing.yaml @@ -22,7 +22,7 @@ jobs: run: ansible-galaxy collection install containers.podman -f - name: Docker login - run: docker login -u="redhat_cop+github_action" -p="${{ secrets.quay_token }}" quay.io + run: docker login -u="redhat_cop+github_action" -p=${{ secrets.QUAY_TOKEN }} quay.io - name: Build EE run: ansible-playbook .github/tests/build_ee.yml -e "ee_registry_username=redhat_cop+github_action" -e "ee_registry_password=${{ secrets.quay_token }}" --connection=local -e "ee_registry_dest=quay.io/redhat_cop/config_as_code_ee" -vvv diff --git a/roles/ee_builder/README.md b/roles/ee_builder/README.md index bb315bf..43de856 100644 --- a/roles/ee_builder/README.md +++ b/roles/ee_builder/README.md @@ -148,6 +148,8 @@ ansible-playbook playbook.yml - awxkit # For import and export modules collections: - name: awx.awx + type: url + source: https://galaxy.ansible.com/download/awx-awx-21.11.0.tar.gz - name: redhat_cop.controller_configuration - name: redhat_cop.ah_configuration prepend: diff --git a/roles/virtualenv_migrate/tasks/01_ee_diff.yml b/roles/virtualenv_migrate/tasks/01_ee_diff.yml index f4329da..156e394 100644 --- a/roles/virtualenv_migrate/tasks/01_ee_diff.yml +++ b/roles/virtualenv_migrate/tasks/01_ee_diff.yml @@ -2,28 +2,28 @@ - name: Diff with EE requirements delegate_to: localhost block: - - name: Diff | Download the default EE on localhost - containers.podman.podman_image: - name: "{{ venv_migrate_default_ee_url }}" - username: "{{ venv_migrate_registry_username }}" - password: "{{ venv_migrate_registry_password }}" + - name: Diff | Download the default EE on localhost + containers.podman.podman_image: + name: "{{ venv_migrate_default_ee_url }}" + username: "{{ venv_migrate_registry_username }}" + password: "{{ venv_migrate_registry_password }}" - - name: Diff | Get pip list from Default EE - ansible.builtin.command: "podman run --rm -it {{ venv_migrate_default_ee_url }} bash -c \"/bin/pip3 freeze\"" - register: __venv_migrate_ee_pip_list_output - changed_when: false + - name: Diff | Get pip list from Default EE + ansible.builtin.command: "podman run --rm -it {{ venv_migrate_default_ee_url }} bash -c \"/bin/pip3 freeze\"" + register: __venv_migrate_ee_pip_list_output + changed_when: false - - name: Diff | Retain the EE pip list without package versions - ansible.builtin.set_fact: - __venv_migrate_ee_pip_list: "{{ __venv_migrate_ee_pip_list_output.stdout.split('\n') | map('regex_replace', '(\\w+)==([\\d+\\.]+).*', '\\1') | list }}" + - name: Diff | Retain the EE pip list without package versions + ansible.builtin.set_fact: + __venv_migrate_ee_pip_list: "{{ __venv_migrate_ee_pip_list_output.stdout.split('\n') | map('regex_replace', '(\\w+)==([\\d+\\.]+).*', '\\1') | list }}" - - name: Diff | Check what's extra in venv and create a requirement list for the new EE and set to ee_python variable - ansible.builtin.set_fact: - venv_migrate_ee_python_list: "{{ venv_migrate_ee_python_list | d([]) + [{item.item: (item.stdout_lines | difference(__venv_migrate_ee_pip_list))}] }}" - loop: "{{ __venv_migrate_combined_requirements_ser }}" - no_log: true + - name: Diff | Check what's extra in venv and create a requirement list for the new EE and set to ee_python variable + ansible.builtin.set_fact: + venv_migrate_ee_python_list: "{{ venv_migrate_ee_python_list | d([]) + [{item.item: (item.stdout_lines | difference(__venv_migrate_ee_pip_list))}] }}" + loop: "{{ __venv_migrate_combined_requirements_ser }}" + no_log: true - - name: Diff | Show the packages that are extra from default EEs in custom venvs. - ansible.builtin.debug: - msg: "{{ venv_migrate_ee_python_list }}" + - name: Diff | Show the packages that are extra from default EEs in custom venvs. + ansible.builtin.debug: + msg: "{{ venv_migrate_ee_python_list }}" ... From 5bfb8cdf0dc3a80dad6d06b848bbbb27977c428d Mon Sep 17 00:00:00 2001 From: sean-m-sullivan Date: Sat, 11 Feb 2023 12:57:30 -0500 Subject: [PATCH 4/8] update lint --- .ansible-lint | 2 +- .pre-commit-config.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index c7de0e1..524b8d0 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -14,7 +14,7 @@ use_default_rules: true # with verbosity set to 1, its dumping 'unknown file type messages' # verbosity: 1 skip_list: - - meta-unsupported-ansible + - meta-runtime kinds: - playbooks: "**/examples/*.{yml,yaml}" - tasks: "**/examples/tasks/*.yml" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 16f93c0..d22fa0c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/ansible-community/ansible-lint.git - rev: v6.12.1 + rev: v6.12.2 hooks: # see discussions here about what arguments are used, and behavior # https://github.com/ansible/ansible-lint/issues/649 From 17a65c7c3ce6bc045336afbf8cbe78309bc04ec8 Mon Sep 17 00:00:00 2001 From: Sean Sullivan Date: Mon, 13 Feb 2023 11:24:22 -0500 Subject: [PATCH 5/8] update readme --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 5cd5e6b..a4bfa4b 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,14 @@ collections: ## Release and Upgrade Notes +## Releasing, Versioning and Deprecation + +This collection follows [Semantic Versioning](https://semver.org/). More details on versioning can be found [in the Ansible docs](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html#collection-versions). + +We plan to regularly release new minor or bugfix versions once new features or bugfixes have been implemented. + +Releasing the current major version happens from the `devel` branch. + ## Roadmap ## Contributing to this collection From 77870467977e109dbe9f40ec02aab297c72e43fc Mon Sep 17 00:00:00 2001 From: Sean Sullivan Date: Tue, 14 Feb 2023 09:49:56 -0500 Subject: [PATCH 6/8] update requirements --- README.md | 5 +++++ bindep.txt | 1 + requirements.txt | 0 requirements.yml | 5 +++++ 4 files changed, 11 insertions(+) delete mode 100644 requirements.txt create mode 100644 requirements.yml diff --git a/README.md b/README.md index a4bfa4b..212dbc8 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,11 @@ This ansible collection includes a number of roles which can be useful for manag * prepare and maintain Ansible Execution Environments +## Requirements + +The containers.podman collection MUST be installed in order for this collection to work. +In addition the podman executable is required for the containers.podman collection. + ## Redhat Communities of Practice Configuration Collections Suite |Collection Name|Purpose| diff --git a/bindep.txt b/bindep.txt index e69de29..5247d59 100644 --- a/bindep.txt +++ b/bindep.txt @@ -0,0 +1 @@ +podman diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index e69de29..0000000 diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..782cdd7 --- /dev/null +++ b/requirements.yml @@ -0,0 +1,5 @@ +--- +collections: + - name: containers.podman + version: ">=1.0.0" +... From f057d31ba33d7cc3d7a7e87a62efe58cd8ffa853 Mon Sep 17 00:00:00 2001 From: sean-m-sullivan Date: Mon, 13 Mar 2023 11:58:11 -0400 Subject: [PATCH 7/8] update linting --- changelogs/fragments/.gitkeep | 0 changelogs/fragments/changed_when_lint.yml | 4 ++++ .../tasks/00_gather_custom_requirements.yml | 2 ++ 3 files changed, 6 insertions(+) create mode 100644 changelogs/fragments/.gitkeep create mode 100644 changelogs/fragments/changed_when_lint.yml diff --git a/changelogs/fragments/.gitkeep b/changelogs/fragments/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/changelogs/fragments/changed_when_lint.yml b/changelogs/fragments/changed_when_lint.yml new file mode 100644 index 0000000..682bc95 --- /dev/null +++ b/changelogs/fragments/changed_when_lint.yml @@ -0,0 +1,4 @@ +--- +minor_changes: + - Added changed_when false to built in commands that gather information. +... diff --git a/roles/virtualenv_migrate/tasks/00_gather_custom_requirements.yml b/roles/virtualenv_migrate/tasks/00_gather_custom_requirements.yml index a80a7bf..466c424 100644 --- a/roles/virtualenv_migrate/tasks/00_gather_custom_requirements.yml +++ b/roles/virtualenv_migrate/tasks/00_gather_custom_requirements.yml @@ -20,12 +20,14 @@ - not venv_migrate_show_diff_with_default - __venv_migrate_virtualenvs | length > 1 register: __venv_migrate_freeze_results + changed_when: false # only gathering information - name: Gather pip freeze output from all venvs including the default venv ansible.builtin.command: "{{ item }}/bin/pip freeze" loop: "{{ __venv_migrate_virtualenvs }}" when: venv_migrate_show_diff_with_default | bool register: __venv_migrate_freeze_results_default + changed_when: false # only gathering information - name: Gather results from pip_freeze based on conditions ansible.builtin.set_fact: From 25281c22c9d3f1de4d3188ae68fccddb630615f0 Mon Sep 17 00:00:00 2001 From: sean-m-sullivan Date: Mon, 13 Mar 2023 19:21:05 -0400 Subject: [PATCH 8/8] update references from redhat_cop to infra --- .github/tests/ee_builder.yaml | 10 +++++----- README.md | 6 +++--- examples/ee_builder_base.yaml | 8 ++++---- examples/ee_venv_migrate.yaml | 10 +++++----- roles/ee_builder/README.md | 14 +++++++------- roles/virtualenv_migrate/README.md | 14 +++++++------- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/.github/tests/ee_builder.yaml b/.github/tests/ee_builder.yaml index 286f3b3..45d045e 100644 --- a/.github/tests/ee_builder.yaml +++ b/.github/tests/ee_builder.yaml @@ -3,8 +3,8 @@ hosts: localhost gather_facts: false collections: - - redhat_cop.ee_utilities - - redhat_cop.controller_configuration + - infra.ee_utilities + - infra.controller_configuration vars: # For ansible.cfg generation # For controller configuration definition @@ -27,8 +27,8 @@ collections: - name: awx.awx version: 21.9.0 - - name: redhat_cop.controller_configuration - - name: redhat_cop.ah_configuration + - name: infra.controller_configuration + - name: infra.ah_configuration prepend: - RUN whoami - RUN cat /etc/os-release @@ -39,5 +39,5 @@ ee_base_image: 2registry.redhat.io/ansible-automation-platform-23/ee-supported-rhel8:latest ee_builder_image: 2registry.redhat.io/ansible-automation-platform-23/ansible-builder-rhel8:latest roles: - - redhat_cop.ee_utilities.ee_builder + - infra.ee_utilities.ee_builder ... diff --git a/README.md b/README.md index 212dbc8..60f45cb 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ Click the `Content` button to see the list of content included in this collectio ## Installing this collection -You can install the redhat_cop ee_utilities collection with the Ansible Galaxy CLI: +You can install the infra.ee_utilities collection with the Ansible Galaxy CLI: - ansible-galaxy collection install redhat_cop.ee_utilities + ansible-galaxy collection install infra.ee_utilities You can also include it in a `requirements.yml` file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format: @@ -39,7 +39,7 @@ You can also include it in a `requirements.yml` file and install it with `ansibl ```yaml --- collections: - - name: redhat_cop.ee_utilities + - name: infra.ee_utilities # If you need a specific version of the collection, you can specify like this: # version: ... ``` diff --git a/examples/ee_builder_base.yaml b/examples/ee_builder_base.yaml index f5fe740..6beae09 100644 --- a/examples/ee_builder_base.yaml +++ b/examples/ee_builder_base.yaml @@ -3,7 +3,7 @@ hosts: localhost gather_facts: false collections: - - redhat_cop.ee_utilities + - infra.ee_utilities vars: ee_builder_dir_clean: true ah_host: ahnosso.node @@ -24,13 +24,13 @@ collections: - name: awx.awx version: 12.0.0 - - name: redhat_cop.controller_configuration - - name: redhat_cop.ah_configuration + - name: infra.controller_configuration + - name: infra.ah_configuration prepend: - RUN whoami - RUN cat /etc/os-release append: - RUN echo This is a post-install command! roles: - - redhat_cop.ee_utilities.ee_builder + - infra.ee_utilities.ee_builder ... diff --git a/examples/ee_venv_migrate.yaml b/examples/ee_venv_migrate.yaml index 01ce01d..3afc88e 100644 --- a/examples/ee_venv_migrate.yaml +++ b/examples/ee_venv_migrate.yaml @@ -3,17 +3,17 @@ hosts: tower gather_facts: false collections: - - redhat_cop.ee_utilities + - infra.ee_utilities vars: venv_migrate_default_ee_url: registry.redhat.io/ansible-automation-platform-23/ee-minimal-rhel8:latest ee_collections: - name: awx.awx - - name: redhat_cop.controller_configuration - - name: redhat_cop.ah_configuration + - name: infra.controller_configuration + - name: infra.ah_configuration tasks: - name: Include venv_migrate role ansible.builtin.include_role: - name: redhat_cop.ee_utilities.virtualenv_migrate + name: infra.ee_utilities.virtualenv_migrate - name: Display ee_list ansible.builtin.debug: @@ -30,7 +30,7 @@ - name: Create EE ansible.builtin.include_role: - name: redhat_cop.ee_utilities.ee_builder + name: infra.ee_utilities.ee_builder - name: Export python virtual enviroment list to file # noqa template-instead-of-copy ansible.builtin.copy: diff --git a/roles/ee_builder/README.md b/roles/ee_builder/README.md index 6ce0fbf..dc646a9 100644 --- a/roles/ee_builder/README.md +++ b/roles/ee_builder/README.md @@ -1,4 +1,4 @@ -# redhat_cop.ee_utilities.ee_builder +# infra.ee_utilities.ee_builder Ansible role use to build execution environments. This role invokes ansible builder and depends on certain variables or files being provided. @@ -131,7 +131,7 @@ ansible-playbook playbook.yml hosts: localhost gather_facts: false collections: - - redhat_cop.ee_utilities + - infra.ee_utilities vars: ee_registry_dest: ahnosso.node ee_registry_username: admin @@ -150,15 +150,15 @@ ansible-playbook playbook.yml - name: awx.awx type: url source: https://galaxy.ansible.com/download/awx-awx-21.11.0.tar.gz - - name: redhat_cop.controller_configuration - - name: redhat_cop.ah_configuration + - name: infra.controller_configuration + - name: infra.ah_configuration prepend: - RUN whoami - RUN cat /etc/os-release append: - RUN echo This is a post-install command! roles: - - redhat_cop.ee_utilities.ee_builder + - infra.ee_utilities.ee_builder ``` This is an example for building using automated pipelines like Gitlab or Azure Devops where the build container and other dependencies used for building the final artifact are destroyed after the pipeline is finished @@ -205,8 +205,8 @@ This is an example for building using automated pipelines like Gitlab or Azure D - name: awx.awx type: url source: https://galaxy.ansible.com/download/awx-awx-21.11.0.tar.gz - - name: redhat_cop.controller_configuration - - name: redhat_cop.ah_configuration + - name: infra.controller_configuration + - name: infra.ah_configuration prepend: - RUN whoami - RUN cat /etc/os-release diff --git a/roles/virtualenv_migrate/README.md b/roles/virtualenv_migrate/README.md index cd65d69..c8f17a1 100644 --- a/roles/virtualenv_migrate/README.md +++ b/roles/virtualenv_migrate/README.md @@ -1,4 +1,4 @@ -# redhat_cop.ee_utilities.virtualenv_migrate +# infra.ee_utilities.virtualenv_migrate Use this role to create a list of python requirements from custom virtualenvs present in your AAP 1.2 cluster, after comparing those with requirements in Default Execution Environment. This role is based on the `awx-manage` utility and needs an AAP1.2 tower node to gather requirements from and localhost to pull EE and compare those requirements. @@ -41,7 +41,7 @@ podman on localhost tasks: - name: Include venv role include_role: - name: redhat_cop.ee_utilities.virtualenv_migrate + name: infra.ee_utilities.virtualenv_migrate ``` ## Example Playbook Using both roles together @@ -53,17 +53,17 @@ podman on localhost hosts: tower gather_facts: false collections: - - redhat_cop.ee_utilities + - infra.ee_utilities vars: venv_migrate_default_ee_url: registry.redhat.io/ansible-automation-platform-23/ee-minimal-rhel8:latest ee_collections: - name: awx.awx - - name: redhat_cop.controller_configuration - - name: redhat_cop.ah_configuration + - name: infra.controller_configuration + - name: infra.ah_configuration tasks: - name: Include venv_migrate role include_role: - name: redhat_cop.ee_utilities.virtualenv_migrate + name: infra.ee_utilities.virtualenv_migrate - name: ee_list ansible.builtin.debug: @@ -82,7 +82,7 @@ podman on localhost - name: Create EE include_role: - name: redhat_cop.ee_utilities.ee_builder + name: infra.ee_utilities.ee_builder - name: Export python virtual enviroment list to file copy: