diff --git a/roles/edpm_tripleo_cleanup/defaults/main.yml b/roles/edpm_tripleo_cleanup/defaults/main.yml new file mode 100644 index 000000000..2cf440887 --- /dev/null +++ b/roles/edpm_tripleo_cleanup/defaults/main.yml @@ -0,0 +1,20 @@ +--- +# Copyright 2024 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +# All variables intended for modification should be placed in this file. + +edpm_old_tripleo_services: [] diff --git a/roles/edpm_tripleo_cleanup/meta/argument_specs.yml b/roles/edpm_tripleo_cleanup/meta/argument_specs.yml new file mode 100644 index 000000000..4f5d30de8 --- /dev/null +++ b/roles/edpm_tripleo_cleanup/meta/argument_specs.yml @@ -0,0 +1,25 @@ +--- +# Copyright 2024 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +argument_specs: + # roles/edpm_tripleo_cleanup/tasks/main.yml entry point + main: + short_description: The main entry point for the edpm_tripleo_cleanup role. + options: + edpm_old_tripleo_services: + type: "list" + description: "List of tripleo services to be disabled" + required: true diff --git a/roles/edpm_tripleo_cleanup/meta/main.yml b/roles/edpm_tripleo_cleanup/meta/main.yml new file mode 100644 index 000000000..48c55c960 --- /dev/null +++ b/roles/edpm_tripleo_cleanup/meta/main.yml @@ -0,0 +1,43 @@ +--- +# Copyright 2024 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +galaxy_info: + namespace: openstack + author: OpenStack + description: EDPM OpenStack Role -- edpm_tripleo_cleanup + company: Red Hat + license: Apache-2.0 + min_ansible_version: '2.9' + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + platforms: + - name: 'EL' + versions: + - '8' + - '9' + + galaxy_tags: + - edpm + + +# List your role dependencies here, one per line. Be sure to remove the '[]' above, +# if you add dependencies to this list. +dependencies: [] diff --git a/roles/edpm_tripleo_cleanup/molecule/default/collections.yml b/roles/edpm_tripleo_cleanup/molecule/default/collections.yml new file mode 100644 index 000000000..afc836d72 --- /dev/null +++ b/roles/edpm_tripleo_cleanup/molecule/default/collections.yml @@ -0,0 +1,3 @@ +--- +collections: + - name: community.general diff --git a/roles/edpm_tripleo_cleanup/molecule/default/converge.yml b/roles/edpm_tripleo_cleanup/molecule/default/converge.yml new file mode 100644 index 000000000..48d62d721 --- /dev/null +++ b/roles/edpm_tripleo_cleanup/molecule/default/converge.yml @@ -0,0 +1,8 @@ +--- +- name: Converge + hosts: all + tasks: + - name: Test edpm_tripleo_cleanup role + ansible.builtin.include_role: + name: "osp.edpm.edpm_tripleo_cleanup" + edpm_old_tripleo_services: [] diff --git a/roles/edpm_tripleo_cleanup/molecule/default/molecule.yml b/roles/edpm_tripleo_cleanup/molecule/default/molecule.yml new file mode 100644 index 000000000..6b80aa9de --- /dev/null +++ b/roles/edpm_tripleo_cleanup/molecule/default/molecule.yml @@ -0,0 +1,37 @@ +--- +dependency: + name: galaxy + options: + role-file: collections.yml +driver: + name: podman +platforms: +- command: /sbin/init + dockerfile: ../../../../molecule/common/Containerfile.j2 + image: ${EDPM_ANSIBLE_MOLECULE_IMAGE:-"ubi9/ubi-init"} + name: instance + privileged: true + registry: + url: ${EDPM_ANSIBLE_MOLECULE_REGISTRY:-"registry.access.redhat.com"} + ulimits: + - host +provisioner: + log: true + name: ansible + inventory: + hosts: + all: + hosts: + instance: + canonical_hostname: edpm-0.localdomain +scenario: + test_sequence: + - dependency + - destroy + - create + - prepare + - converge + - verify + - destroy +verifier: + name: ansible diff --git a/roles/edpm_tripleo_cleanup/molecule/default/prepare.yml b/roles/edpm_tripleo_cleanup/molecule/default/prepare.yml new file mode 100644 index 000000000..1ed54e756 --- /dev/null +++ b/roles/edpm_tripleo_cleanup/molecule/default/prepare.yml @@ -0,0 +1,21 @@ +--- +# Copyright 2024 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +- name: Prepare test_deps + hosts: all + roles: + - role: ../../../../molecule/common/test_deps + test_deps_extra_packages: + - podman diff --git a/roles/edpm_tripleo_cleanup/tasks/main.yml b/roles/edpm_tripleo_cleanup/tasks/main.yml new file mode 100644 index 000000000..2cbd9ad7d --- /dev/null +++ b/roles/edpm_tripleo_cleanup/tasks/main.yml @@ -0,0 +1,28 @@ +--- +# Copyright 2024 Red Hat, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +- name: Stop tripleo services + ansible.builtin.systemd_service: + name: "{{ item }}" + state: stopped + loop: "{{ edpm_old_tripleo_services }}" + + +- name: Disable tripleo services + ansible.builtin.systemd_service: + name: "{{ item }}" + enabled: false + loop: "{{ edpm_old_tripleo_services }}"