From a36d9ba592a6745579c84f0aab99e17820d2d442 Mon Sep 17 00:00:00 2001 From: akumari Date: Fri, 12 Jul 2024 16:32:48 +0530 Subject: [PATCH] Drop CentOS 7 boxes --- README.md | 2 +- docs/development.md | 20 ++-- docs/library.md | 6 +- docs/plugins.md | 2 +- docs/production.md | 16 ++-- docs/provision.md | 14 +-- docs/testing.md | 20 ++-- packer/README.md | 47 +++++---- packer/scripts/build_stable_dev_box.rb | 11 +-- .../vars/common/foreman_nightly_centos9.yml | 4 + .../vars/common/katello_nightly_centos9.yml | 4 + .../tasks/configure_centos_7.yml | 40 -------- .../tasks/configure_centos_9.yml | 40 ++++++++ roles/foreman_provisioning/tasks/main.yml | 2 +- roles/hammer_devel/defaults/main.yml | 2 +- roles/katello_provisioning/tasks/main.yml | 96 +++++++++---------- vagrant/boxes.d/00-centos.yaml | 21 ---- vagrant/boxes.d/01-builtin.yaml | 26 ++--- vagrant/boxes.d/02-kubevirt.yaml | 4 +- vagrant/boxes.d/99-local.yaml.example | 8 -- vagrant/config/versions.yaml | 2 - 21 files changed, 181 insertions(+), 206 deletions(-) create mode 100644 pipelines/vars/common/foreman_nightly_centos9.yml create mode 100644 pipelines/vars/common/katello_nightly_centos9.yml delete mode 100644 roles/foreman_provisioning/tasks/configure_centos_7.yml create mode 100644 roles/foreman_provisioning/tasks/configure_centos_9.yml diff --git a/README.md b/README.md index 0343d67d3..b5718ad20 100644 --- a/README.md +++ b/README.md @@ -335,7 +335,7 @@ boxes: exclude: - "katello" # exclude any box containing "katello" - "ubuntu1804-foreman-2\\.0" # exclude only the box "ubuntu1804-foreman-2.0". Notice the escaped '.' character to match the specific character instead of any single character - - "^centos7-fips" # exclude any box that starts with "centos7-fips" + - "^centos9-stream" # exclude any box that starts with "centos9-stream" - "foreman-1\\.(?:[2][0-3])" # exclude any foreman-1.20 to foreman-1.23 version box ``` diff --git a/docs/development.md b/docs/development.md index 0c816784e..ab74a94fc 100644 --- a/docs/development.md +++ b/docs/development.md @@ -240,11 +240,11 @@ importing/exporting data via [CSV](https://github.com/Katello/hammer-cli-csv). The CLI can be configured to work with any version of Foreman. To facilitate development in Hammer or any of its plugins, a lightweight vagrant box is provided in the `boxes.yaml.example` file. To use this functionality, copy the -centos7-hammer-devel configuration from the example file into your `boxes.yaml` +almalinux8-hammer-devel configuration from the example file into your `boxes.yaml` file, changing options as necessary. Then run the following: ```sh -vagrant up centos7-hammer-devel +vagrant up almalinux8-hammer-devel ``` In the vagrant box, find the Hammer repositories at `/home/vagrant/` and the @@ -261,7 +261,7 @@ changing the hostnames as needed ```yaml capsule-dev: - box: centos7 + box: centos9-stream ansible: playbook: 'playbooks/foreman_proxy_content_dev.yml' group: 'foreman-proxy-content' @@ -283,7 +283,7 @@ capsule-dev: ```yaml capsule-dev: - box: centos7 + box: centos9-stream ansible: playbook: 'playbooks/foreman_proxy_content_dev.yml' group: 'foreman-proxy-content' @@ -299,7 +299,7 @@ The following example shows some of the extra values that can be set to control ```yaml katello-client: - box: centos7 + box: centos9-stream ansible: playbook: 'playbooks/katello_client.yml' group: 'client' @@ -320,19 +320,19 @@ To use this box, copy the configuration from `boxes.yaml.example` to `boxes.yaml`, changing options as necessary, then run the following: ```sh -vagrant up centos7-dynflow-devel +vagrant up almalinux8-dynflow-devel ``` In the vagrant box, the dynflow repository is cloned to `/home/vagrant/dynflow`. ## Smoker -The testing tool [smoker](https://github.com/theforeman/smoker) can be set up with the `centos7-foreman-smoker` box and tests can be run against a separate Foreman/Katello instance. +The testing tool [smoker](https://github.com/theforeman/smoker) can be set up with the `almalinux8-foreman-smoker` box and tests can be run against a separate Foreman/Katello instance. To use: 1. Ensure that you have a running instance of Foreman/Katello. -2. Follow the example box definition in `vagrant/boxes.d/99-local.yaml.example` for `centos7-foreman-smoker` and update the `smoker_base_url` variable. With `pytest_run_tests` set to false, smoker tests will not be run by the playbook, but the box will be set up with pytest and the smoker repository will be cloned to the `vagrant` user's home directory. -3. Run `vagrant up centos7-foreman-smoker`. A debug message will print showing the command to run smoker tests and the alias that has been set up. The alias is defined in `~/.bash_profile` on the box itself. +2. Follow the example box definition in `vagrant/boxes.d/99-local.yaml.example` for `almalinux8-foreman-smoker` and update the `smoker_base_url` variable. With `pytest_run_tests` set to false, smoker tests will not be run by the playbook, but the box will be set up with pytest and the smoker repository will be cloned to the `vagrant` user's home directory. +3. Run `vagrant up almalinux8-foreman-smoker`. A debug message will print showing the command to run smoker tests and the alias that has been set up. The alias is defined in `~/.bash_profile` on the box itself. 4. You can then ssh into the smoker box. Ensure the hostname of the Foreman/Katello instance can be reached by the smoker box. 5. From the smoker box, run tests as the vagrant user using the alias or running pytest commands manually. To change the testing options, please see [the smoker documentation](https://github.com/theforeman/smoker) and modify the alias or manually run pytest commands as necessary. @@ -381,7 +381,7 @@ If you choose longer name you're on your own, contributions with fixes welcome! # boxes.d/99-local.yaml foreman-ad: - box: centos7 + box: centos9-stream memory: 4096 domain: 'example.com' # must be the AD domain ansible: diff --git a/docs/library.md b/docs/library.md index e3e15fec0..f4fdbc6d9 100644 --- a/docs/library.md +++ b/docs/library.md @@ -31,9 +31,9 @@ Deploy a file with the base set of boxes the plugin requires: vim base_boxes.yaml ```yaml -centos7: - box_name: 'centos/7' - image_name: !ruby/regexp '/CentOS 7.*PV/' +centos9: + box_name: 'centos/9' + image_name: !ruby/regexp '/CentOS 9.*PV/' pty: true ``` diff --git a/docs/plugins.md b/docs/plugins.md index e39cbec7b..0562f31b0 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -11,7 +11,7 @@ module APlugin DB = 'db' WEB = 'web' - PARENT_NAME = 'centos7-katello-devel' + PARENT_NAME = 'centos9-katello-devel' PROJECT_PATH = "#{Forklift::ROOT}/../a_repo" Forklift.define_vm config, Forklift.new_box(PARENT_NAME, DB) do |machine| diff --git a/docs/production.md b/docs/production.md index c5032b555..fe234f720 100644 --- a/docs/production.md +++ b/docs/production.md @@ -39,18 +39,18 @@ vagrant status This will show a list of boxes by type and OS. For example, at the time of this documentation both Foreman 1.12 and Katello 3.1 had been released. Thus, when doing a status I see, for example: ``` -centos7-foreman-nightly not created (libvirt) -centos7-katello-nightly not created (libvirt) -centos7-foreman-proxy-nightly not created (libvirt) -centos7-foreman-1.16 not created (libvirt) -centos7-katello-3.4 not created (libvirt) +centos9-stream-foreman-nightly not created (libvirt) +centos9-stream-katello-nightly not created (libvirt) +centos9-stream-foreman-proxy-nightly not created (libvirt) +centos9-stream-foreman-3.11 not created (libvirt) +centos9-stream-katello-4.13 not created (libvirt) ``` -This indicates that both Foreman and Katello nightly (our unstable releases) are available as well as production installations on Centos 7 boxes of Foreman, Katello and a Foreman Proxy. To fire up a Katello 3.4: +This indicates that both Foreman and Katello nightly (our unstable releases) are available as well as production installations on Centos 9 boxes of Foreman, Katello and a Foreman Proxy. To fire up a Katello 4.13: -Start the installation for CentOS 7: +Start the installation for CentOS 9: - vagrant up centos7-katello-3.4 + vagrant up centos9-stream-katello-4.13 This will create a libvirt based virtual machine running the Katello server on CentOS. diff --git a/docs/provision.md b/docs/provision.md index 091ed453a..5dfd13f11 100644 --- a/docs/provision.md +++ b/docs/provision.md @@ -15,10 +15,10 @@ reboot: 2. Build a box - - Option 1: Use the `centos7-provision-nightly` box. + - Option 1: Use the `centos9-provision-nightly` box. - - Option 2: Use an existing katello box (e.g. centos7-katello-p4-nightly) and run the provisioning playbook (it takes a while, as it syncs (on-demand) centos7, puppet 4). ***Note*: If you are using puppet 4, you need to increase the ram on the box, to something like 8096 otherwise candlepin crashes with OOM.** - `ansible-playbook -l centos7-katello-p4-nightly playbooks/katello_provisioning.yml` + - Option 2: Use an existing katello box (e.g. centos9-katello-p7-nightly) and run the provisioning playbook (it takes a while, as it syncs (on-demand) centos9, puppet 7). ***Note*: If you are using puppet 7, you need to increase the ram on the box, to something like 8096 otherwise candlepin crashes with OOM.** + `ansible-playbook -l centos9-katello-p7-nightly playbooks/katello_provisioning.yml` 4. Login and create a compute profile, because this isn't possible with hammer or the API. @@ -26,7 +26,7 @@ reboot: - Click "libvirt" - Click Compute profiles - Click 2-Medium - - increse ram to 1024MB (required for centos 7) + - increse ram to 2048MB (required for centos 9) - change network type to NAT, network name = provision - Click Submit @@ -37,9 +37,9 @@ reboot: 6. Configure / Host groups - - Edit Forklift CentOS 7 + - Edit Forklift CentOS 9 - Set Compute profile to be "2-Medium" - - Assign the `CentOS 7` activation key to the host group + - Assign the `CentOS 9` activation key to the host group 7. You're good to go! Let's provision a box! @@ -50,4 +50,4 @@ reboot: DONE! Click submit :tada: -7. If you want to view the console while it boots, make sure to trust the CA certificate in your browser, it's hosted at https://centos7-katello-nightly.example.com/pub/katello-server-ca.crt, and you'll need to make sure you're accessing the katello via it's proper hostname (add an entry to /etc/hosts) +7. If you want to view the console while it boots, make sure to trust the CA certificate in your browser, it's hosted at https://centos9-katello-nightly.example.com/pub/katello-server-ca.crt, and you'll need to make sure you're accessing the katello via it's proper hostname (add an entry to /etc/hosts) diff --git a/docs/testing.md b/docs/testing.md index 16315774b..96c9132a2 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -28,10 +28,10 @@ Included with forklift is a small live test suite. The current tests are: ``` cp boxes.yaml.example boxes.yaml -vagrant up centos7-katello-bats-ci +vagrant up almalinux8-katello-bats-ci ``` -If you are making changes to bats tests and want to test your updates, edit `centos7-katello-bats-ci` to include: +If you are making changes to bats tests and want to test your updates, edit `almalinux8-katello-bats-ci` to include: ```yaml ansible: @@ -41,7 +41,7 @@ ansible: bats_update_forklift: "no" ``` -Or if you want to run bats from a different repository or branch, edit `centos7-katello-bats-ci` to include: +Or if you want to run bats from a different repository or branch, edit `almalinux8-katello-bats-ci` to include: ```yaml ansible: @@ -79,18 +79,18 @@ When you are finished with the test, you can tear down the associated infrastruc ### Existing Pipelines * `install_pipeline` - Installs a Server and a Proxy VMs and runs the `foreman_testing` role to verify the setup. - Expects the `pipeline_os` variable to be set to a known OS (currently: centos7, debian10) + Expects the `pipeline_os` variable to be set to a known OS (currently: centos9-stream, debian10) Expects the `pipeline_type` variable to be set to a known type (currently: foreman, katello, luna) Expects the `pipeline_version` variable to be set to a known version (currently: 3.8, 3.9, 3.10, 3.11, nightly) * `upgrade_pipeline` - Installs a VM, upgrades it twice and runs the `foreman_testing` role to verify the final upgrade. - Expects the `pipeline_os` variable to be set to a known OS (currently: centos7, debian10) + Expects the `pipeline_os` variable to be set to a known OS (currently: centos9-stream, debian10) Expects the `pipeline_type` variable to be set to a known type (currently: foreman, katello, luna) Expects the `pipeline_version` variable to be set to a known version (currently: 3.8, 3.9, 3.10, 3.11, nightly). #### Examples ansible-playbook pipelines/install_pipeline.yml -e forklift_state=up -e pipeline_os=debian10 -e pipeline_type=foreman -e pipeline_version=nightly - ansible-playbook pipelines/upgrade_pipeline.yml -e forklift_state=up -e pipeline_os=centos7 -e pipeline_type=katello -e pipeline_version=3.10 + ansible-playbook pipelines/upgrade_pipeline.yml -e forklift_state=up -e pipeline_os=centos9-stream -e pipeline_type=katello -e pipeline_version=3.10 ### Creating Pipelines @@ -102,11 +102,11 @@ For Katello 3.11, you'd be adding the following two files: ```yaml forklift_name: pipeline-katello-3.11 forklift_boxes: - pipeline-katello-3.11-centos7: - box: centos7 + pipeline-katello-3.11-centos9: + box: centos9-stream memory: 8192 - pipeline-proxy-3.11-centos7: - box: centos7 + pipeline-proxy-3.11-centos9: + box: centos9-stream memory: 3072 katello_repositories_version: '3.11' foreman_repositories_version: '1.21' diff --git a/packer/README.md b/packer/README.md index b5e1ec4b5..2ac98fd60 100644 --- a/packer/README.md +++ b/packer/README.md @@ -4,41 +4,40 @@ This directory contains [packer](https://www.packer.io/) templates to create ima You can install packer using [the steps in their documentation](http://packer.io/intro/getting-started/install.html). For Fedora and Red Hat flavor distributions, be aware there can be another executable installed named `packer`, so you will have to install the `packer` executable under another name or call it with an absolute path. See [their documentation for more info](http://packer.io/intro/getting-started/install.html#troubleshooting) -*Be aware* that enabling the hashicorp repo will make an updated vagrant rpm available. If you are using the Fedora-supplied vagrant, disable this repository immediately after installing packer. +*Be aware* that enabling the hashicorp repo will make an updated vagrant rpm available. If you are using the Fedora-supplied vagrant, disable this repository immediately after installing packer. ### Local usage From this directory, use `packer build` followed by the json packer template to create an image -For example: `packer build centos7-katello-devel-stable.json` +For example: `packer build almalinux8-katello-devel-stable.json` You can create a box image using the above command and then add that box to vagrant: ``` -vagrant box add --name centos7-katello-devel-stable centos7-katello-devel-stable.box +vagrant box add --name almalinux8-katello-devel-stable almalinux8-katello-devel-stable.box ``` -Then you can use it in a box definition. For the box built with `centos7-katello-devel-stable.json`, you will need to use the stable hostname. +Then you can use it in a box definition. For the box built with `almalinux8-katello-devel-stable.json`, you will need to use the stable hostname. ``` -centos7-katello-devel-stable: - box_name: centos7-katello-devel-stable - hostname: centos7-katello-devel-stable.example.com +almalinux8-katello-devel-stable: + box_name: almalinux8-katello-devel-stable + hostname: almalinux8-katello-devel-stable.example.com ``` -You can then `vagrant up centos7-katello-devel-stable` - +You can then `vagrant up almalinux8-katello-devel-stable` If you want to completely remove the box, be sure to remove from both vagrant and virsh. This can be helpful if you have built a new packer box image and want to use it. ``` -vagrant box remove centos7-katello-devel-stable -sudo virsh vol-delete --pool default centos7-katello-devel-stable_vagrant_box_image_0.img +vagrant box remove almalinux8-katello-devel-stable +sudo virsh vol-delete --pool default almalinux8-katello-devel-stable_vagrant_box_image_0.img ``` ## Creating version specific Katello devel boxes -Versioned Katello devel boxes allow easier patch development on old versions of Katello. This could be used for creating a fix or updating a vcr cassette for an older release. +Versioned Katello devel boxes allow easier patch development on old versions of Katello. This could be used for creating a fix or updating a vcr cassette for an older release. To create a version specific dev box, follow the directions above to install packer, then: @@ -46,30 +45,30 @@ To create a version specific dev box, follow the directions above to install pac cd ./forklift/packer ``` -and run this comand (replacing 3.18 with the correct version): +and run this comand (replacing 4.13 with the correct version): ``` -./scripts/build_stable_dev_box.rb 3.18 +./scripts/build_stable_dev_box.rb 4.13 ``` To test the newly created box: 1. add the printed box definition to vagrant/boxes.d/99-local.yaml 2. run printed 'vagrant box add' command -3. vagrant up centos7-katello-3.18-stable +3. vagrant up centos9-stream-katello-4.13-stable 4. Verify that 'rpm -q katello-repos' is correct and the foreman and katello git repos are on the correct branches ## Uploading a versioned box to Vagrant Cloud The version of Vagrant shipped with Fedora does not support Vagrant Cloud uploads (due to a library licensing issue): -1. Deploy a Centos 7 VM (vagrant up centos7) +1. Deploy a Centos 9 VM (vagrant up centos9-stream) 2. Install latest vagrant from: https://www.vagrantup.com/docs/installation -3. scp the .box file over to the centos 7 vm -4. Run 'vagrant login' and login with your credentials +3. scp the .box file over to the centos 9 vm +4. Run 'vagrant login' and login with your credentials 5. Ensure you are an owner of the katello organization in vagrant cloud 6. Use the command from the build_stable_dev_box.rb output to publish the box, it will look like: ``` -vagrant cloud publish -d "katello-devel 3.18" -s "katello-devel 3.18" katello/katello-devel 3.18.0 libvirt centos7-katello-3.18-stable.box +vagrant cloud publish -d "katello-devel 4.13" -s "katello-devel 4.13" katello/katello-devel 4.13.0 libvirt centos9-stream-katello-4.13-stable.box ``` NOTE: YOU WILL GET AN ERROR, BUT THE UPLOAD WILL ACTUALLY WORK. This only happens during large box uploads to vagrant cloud. The error will look like: @@ -90,17 +89,17 @@ Empty reply from server Within your local vagrant boxes file, add: ``` -centos7-katello-3.18-stable: +centos9-stream-katello-4.13-stable: box_name: katello/katello-devel - box_version: 3.18.0 + box_version: 4.13.0 ``` -changing 3.18.0 to the version you desire. Then: +changing 4.13.0 to the version you desire. Then: ``` -vagrant up centos7-katello-3.18-stable +vagrant up centos9-stream-katello-4.13-stable ``` ## Vagrant cloud usage -The centos7-katello-devel-stable box is [published to Vagrant cloud](https://app.vagrantup.com/katello/boxes/katello-devel) on a nightly basis to ensure an image with the latest changes is available. This box is only published if the Katello install is successful. +The centos9-katello-devel-stable box is [published to Vagrant cloud](https://app.vagrantup.com/katello/boxes/katello-devel) on a nightly basis to ensure an image with the latest changes is available. This box is only published if the Katello install is successful. diff --git a/packer/scripts/build_stable_dev_box.rb b/packer/scripts/build_stable_dev_box.rb index a9d4e29ee..f94bc4275 100755 --- a/packer/scripts/build_stable_dev_box.rb +++ b/packer/scripts/build_stable_dev_box.rb @@ -47,15 +47,15 @@ def write_json_file(json) def print_message(version_string) puts "=========================" puts "To try out this box:" - puts "# vagrant box add centos7-katello-#{version_string}-stable.box --name 'katello/katello-devel-#{version_string}-test' " + puts "# vagrant box add centos9-katello-#{version_string}-stable.box --name 'katello/katello-devel-#{version_string}-test' " puts "" puts "Use this box definition:" - puts "centos7-katello-#{version_string}-stable:" + puts "centos9-katello-#{version_string}-stable:" puts " box_name: katello/katello-devel-#{version_string}-test" - puts " hostname: centos7-katello-devel-#{version_string}.example.com" + puts " hostname: centos9-katello-devel-#{version_string}.example.com" puts "" puts "To publish this box, run:" - puts "vagrant-upstream cloud publish -d \"katello-devel #{version_string}\" -s \"katello-devel #{version_string}\" katello/katello-devel #{version_string}.0 libvirt centos7-katello-#{version_string}-stable.box" + puts "vagrant-upstream cloud publish -d \"katello-devel #{version_string}\" -s \"katello-devel #{version_string}\" katello/katello-devel #{version_string}.0 libvirt centos9-katello-#{version_string}-stable.box" end katello_version = ARGV[0] @@ -64,7 +64,7 @@ def print_message(version_string) puts "Using configuration: #{json}" filename = write_json_file(json) -command = "/usr/bin/packer build --var packer_hostname=centos7-katello-#{katello_version}-stable --var ansible_variables=\"@#{filename}\" centos7-katello-devel-stable.json" +command = "/usr/bin/packer build --var packer_hostname=centos9-katello-#{katello_version}-stable --var ansible_variables=\"@#{filename}\" centos9-katello-devel-stable.json" puts "Running: #{command}" if system(command) print_message(katello_version) @@ -72,4 +72,3 @@ def print_message(version_string) puts "Build failed, see output above for more details." exit -1 end - diff --git a/pipelines/vars/common/foreman_nightly_centos9.yml b/pipelines/vars/common/foreman_nightly_centos9.yml new file mode 100644 index 000000000..4e1df6a05 --- /dev/null +++ b/pipelines/vars/common/foreman_nightly_centos9.yml @@ -0,0 +1,4 @@ +--- +pipeline_type: foreman +pipeline_os: centos9-stream +pipeline_version: nightly diff --git a/pipelines/vars/common/katello_nightly_centos9.yml b/pipelines/vars/common/katello_nightly_centos9.yml new file mode 100644 index 000000000..0f56de4dd --- /dev/null +++ b/pipelines/vars/common/katello_nightly_centos9.yml @@ -0,0 +1,4 @@ +--- +pipeline_type: katello +pipeline_os: centos9-stream +pipeline_version: nightly diff --git a/roles/foreman_provisioning/tasks/configure_centos_7.yml b/roles/foreman_provisioning/tasks/configure_centos_7.yml deleted file mode 100644 index 4d4bd485f..000000000 --- a/roles/foreman_provisioning/tasks/configure_centos_7.yml +++ /dev/null @@ -1,40 +0,0 @@ -- name: 'set CentOS medium name' - set_fact: - centos_medium_name: "{{ 'CentOS 7 mirror' if foreman_provisioning_foreman_version == 'nightly' or (foreman_provisioning_foreman_version is version_compare('2.1', '>=')) else 'CentOS mirror' }}" - -- name: 'create CentOS 7' - shell: > - {{ foreman_provisioning_hammer }} os info --title "CentOS 7" || - {{ foreman_provisioning_hammer }} os create - --name CentOS --major 7 --architectures x86_64 --family 'Redhat' --media '{{ centos_medium_name }}' --partition-tables 'Kickstart default' - -- name: 'find CentOS 7' - shell: > - {{ foreman_provisioning_hammer }} --output json os info --name "CentOS 7" || - {{ foreman_provisioning_hammer }} --output json os info --title "CentOS 7" - register: foreman_provisioning_centos73_json - ignore_errors: True - -- name: 'get CentOS 7 info' - set_fact: - foreman_provisioning_centos73: "{{ foreman_provisioning_centos73_json.stdout|from_json }}" - -- name: 'find kickstart templates' - shell: > - {{ foreman_provisioning_hammer }} --output=json template list - --search 'name ~ "Kickstart default"' - register: kickstart_templates_json - -- name: 'set kickstart templates' - set_fact: - kickstart_templates: "{{ kickstart_templates_json.stdout|from_json }}" - -- name: 'associate kickstart templates to CentOS 7' - shell: > - {{ foreman_provisioning_hammer }} template add-operatingsystem --id {{ item.Id }} --operatingsystem 'CentOS 7' - with_items: "{{ kickstart_templates }}" - -- name: 'set default templates for CentOS 7' - shell: > - {{ foreman_provisioning_hammer }} os set-default-template --id {{ foreman_provisioning_centos73.Id }} --provisioning-template-id {{ item.Id }} - with_items: "{{ kickstart_templates }}" diff --git a/roles/foreman_provisioning/tasks/configure_centos_9.yml b/roles/foreman_provisioning/tasks/configure_centos_9.yml new file mode 100644 index 000000000..bb6de6e56 --- /dev/null +++ b/roles/foreman_provisioning/tasks/configure_centos_9.yml @@ -0,0 +1,40 @@ +- name: "set CentOS medium name" + set_fact: + centos_medium_name: "CentOS Stream 9 mirror" + +- name: "create CentOS 9" + shell: > + {{ foreman_provisioning_hammer }} os info --title "CentOS 9" || + {{ foreman_provisioning_hammer }} os create + --name CentOS --major 9 --architectures x86_64 --family 'Redhat' --media '{{ centos_medium_name }}' --partition-tables 'Kickstart default' + +- name: "find CentOS 9" + shell: > + {{ foreman_provisioning_hammer }} --output json os info --name "CentOS 9" || + {{ foreman_provisioning_hammer }} --output json os info --title "CentOS 9" + register: foreman_provisioning_centos_json + ignore_errors: True + +- name: "get CentOS 9 info" + set_fact: + foreman_provisioning_centos9: "{{ foreman_provisioning_centos9_json.stdout|from_json }}" + +- name: "find kickstart templates" + shell: > + {{ foreman_provisioning_hammer }} --output=json template list + --search 'name ~ "Kickstart default"' + register: kickstart_templates_json + +- name: "set kickstart templates" + set_fact: + kickstart_templates: "{{ kickstart_templates_json.stdout|from_json }}" + +- name: "associate kickstart templates to CentOS 9" + shell: > + {{ foreman_provisioning_hammer }} template add-operatingsystem --id {{ item.Id }} --operatingsystem 'CentOS 9' + with_items: "{{ kickstart_templates }}" + +- name: "set default templates for CentOS 9" + shell: > + {{ foreman_provisioning_hammer }} os set-default-template --id {{ foreman_provisioning_centos9.Id }} --provisioning-template-id {{ item.Id }} + with_items: "{{ kickstart_templates }}" diff --git a/roles/foreman_provisioning/tasks/main.yml b/roles/foreman_provisioning/tasks/main.yml index 3079ffa36..a8b9ef18a 100644 --- a/roles/foreman_provisioning/tasks/main.yml +++ b/roles/foreman_provisioning/tasks/main.yml @@ -1,6 +1,6 @@ --- - name: 'Setup CentOS 7 provisioning' - import_tasks: configure_centos_7.yml + import_tasks: configure_centos_9.yml - name: 'Setup Fedora 27 provisioning' import_tasks: configure_fedora_27.yml diff --git a/roles/hammer_devel/defaults/main.yml b/roles/hammer_devel/defaults/main.yml index 060130add..11676dfd7 100644 --- a/roles/hammer_devel/defaults/main.yml +++ b/roles/hammer_devel/defaults/main.yml @@ -1,7 +1,7 @@ --- hammer_devel_ruby_version: 2.3.1 hammer_devel_server_group: "server-{{ inventory_hostname }}" -hammer_devel_server: "centos7-katello-devel" +hammer_devel_server: "centos9-katello-devel" hammer_devel_server_protocol: 'https' hammer_devel_server_port: 443 hammer_devel_host: "{{ hammer_devel_server_protocol }}://{{ hammer_devel_server }}:{{ hammer_devel_server_port }}" diff --git a/roles/katello_provisioning/tasks/main.yml b/roles/katello_provisioning/tasks/main.yml index 5874c9c6f..91158b82d 100644 --- a/roles/katello_provisioning/tasks/main.yml +++ b/roles/katello_provisioning/tasks/main.yml @@ -19,7 +19,7 @@ - name: 'find centos repo' shell: > {{ katello_provisioning_hammer }} repository info - --name "CentOS 7" + --name "CentOS 9" --product "CentOS" --organization "{{ katello_provisioning_organization }}" register: katello_provisioning_repo @@ -30,8 +30,8 @@ {{ katello_provisioning_hammer }} repository create --product="CentOS" --content-type="yum" - --name "CentOS 7" - --url http://mirror.centos.org/centos/7/os/x86_64 + --name "CentOS 9" + --url http://mirror.centos.org/centos/9/os/x86_64 --download-policy {{ katello_provisioning_download_policy }} --organization "{{ katello_provisioning_organization }}" when: katello_provisioning_repo.stderr.find('not found') != -1 @@ -39,7 +39,7 @@ - name: 'sync the centos repo' shell: > {{ katello_provisioning_hammer }} repository synchronize - --name "CentOS 7" + --name "CentOS 9" --product "CentOS" --organization "{{ katello_provisioning_organization }}" when: katello_provisioning_sync_repos @@ -60,7 +60,7 @@ --product="CentOS" --content-type="yum" --name "Foreman Client" - --url https://yum.theforeman.org/client/{{ foreman_repositories_version }}/el7/x86_64 + --url https://yum.theforeman.org/client/{{ foreman_repositories_version }}/el9/x86_64 --download-policy {{ katello_provisioning_download_policy }} --organization "{{ katello_provisioning_organization }}" when: foreman_client_repo.stderr.find('not found') != -1 @@ -89,7 +89,7 @@ --product="CentOS" --content-type="yum" --name "Puppet 5" - --url https://yum.puppetlabs.com/puppet5/el/7/x86_64/ + --url https://yum.puppetlabs.com/puppet5/el/9/x86_64/ --download-policy {{ katello_provisioning_download_policy }} --organization "{{ katello_provisioning_organization }}" when: katello_puppet_repo.stderr.find('not found') != -1 @@ -106,7 +106,7 @@ - name: 'find epel repo' shell: > {{ katello_provisioning_hammer }} repository info - --name "EPEL 7" + --name "EPEL 9" --product "CentOS" --organization "{{ katello_provisioning_organization }}" register: katello_epel_repo @@ -117,8 +117,8 @@ {{ katello_provisioning_hammer }} repository create --product="CentOS" --content-type="yum" - --name "EPEL 7" - --url "https://dl.fedoraproject.org/pub/epel/7/x86_64" + --name "EPEL 9" + --url "https://dl.fedoraproject.org/pub/epel/9/x86_64" --download-policy {{ katello_provisioning_download_policy }} --organization "{{ katello_provisioning_organization }}" when: katello_epel_repo.stderr.find('not found') != -1 @@ -126,7 +126,7 @@ - name: 'sync the epel repo' shell: > {{ katello_provisioning_hammer }} repository synchronize - --name "EPEL 7" + --name "EPEL 9" --product "CentOS" --organization "{{ katello_provisioning_organization }}" when: katello_provisioning_sync_repos @@ -146,7 +146,7 @@ --product="CentOS" --content-type="yum" --name "Foreman Plugins" - --url "http://yum.theforeman.org/plugins/{{ foreman_repositories_version }}/el7/x86_64/" + --url "http://yum.theforeman.org/plugins/{{ foreman_repositories_version }}/el9/x86_64/" --download-policy {{ katello_provisioning_download_policy }} --organization "{{ katello_provisioning_organization }}" when: "'not found' in katello_foreman_plugins_repo.stderr" @@ -163,7 +163,7 @@ - name: 'find activation key' shell: > {{ katello_provisioning_hammer }} activation-key info - --name "CentOS 7" + --name "CentOS 9" --organization "{{ katello_provisioning_organization }}" register: katello_provisioning_activation_key ignore_errors: True @@ -172,7 +172,7 @@ shell: > {{ katello_provisioning_hammer }} activation-key create --organization "{{ katello_provisioning_organization }}" - --name="CentOS 7" + --name="CentOS 9" --content-view="Default Organization View" --lifecycle-environment="Library" --unlimited-hosts @@ -188,43 +188,43 @@ shell: > {{ katello_provisioning_hammer }} activation-key add-subscription --organization '{{ katello_provisioning_organization }}' - --name 'CentOS 7' + --name 'CentOS 9' --subscription-id {{ item.Id }} with_items: "{{ subscriptions_json.stdout | from_json }}" # Associate templates -- name: 'find CentOS 7' +- name: 'find CentOS 9' shell: > - {{ katello_provisioning_hammer }} --output json os info --title "CentOS 7" - register: katello_provisioning_centos7_json + {{ katello_provisioning_hammer }} --output json os info --title "CentOS 9" + register: katello_provisioning_centos9_json ignore_errors: True -- name: 'get CentOS 7 info' +- name: 'get CentOS 9 info' set_fact: - katello_provisioning_centos7: "{{ katello_provisioning_centos7_json.stdout|from_json }}" - when: katello_provisioning_centos7_json is success + katello_provisioning_centos9: "{{ katello_provisioning_centos9_json.stdout|from_json }}" + when: katello_provisioning_centos9_json is success -- when: "'not found' in katello_provisioning_centos7_json.stderr" +- when: "'not found' in katello_provisioning_centos9_json.stderr" block: - - name: 'Create CentOS_Linux 7' + - name: 'Create CentOS_Linux 9' shell: > {{ katello_provisioning_hammer }} os create - --name CentOS_Linux --major 7 --architectures x86_64 --family 'Redhat' + --name CentOS_Linux --major 9 --architectures x86_64 --family 'Redhat' - - name: 'find newly created CentOS_Linux 7' + - name: 'find newly created CentOS_Linux 9' shell: > - {{ katello_provisioning_hammer }} --output json os info --name "CentOS_Linux 7" || - {{ katello_provisioning_hammer }} --output json os info --title "CentOS_Linux 7" - register: katello_provisioning_centos7_json_new + {{ katello_provisioning_hammer }} --output json os info --name "CentOS_Linux 9" || + {{ katello_provisioning_hammer }} --output json os info --title "CentOS_Linux 9" + register: katello_provisioning_centos9_json_new - - name: 'get new CentOS 7 info' + - name: 'get new CentOS 9 info' set_fact: - katello_provisioning_centos7: "{{ katello_provisioning_centos7_json_new.stdout|from_json }}" + katello_provisioning_centos9: "{{ katello_provisioning_centos9_json_new.stdout|from_json }}" -- name: 'update partition table for CentOS 7' +- name: 'update partition table for CentOS 9' shell: > - {{ katello_provisioning_hammer }} os update --id {{ katello_provisioning_centos7.Id }} --partition-tables 'Kickstart default' - register: katello_provisioning_centos7_json + {{ katello_provisioning_hammer }} os update --id {{ katello_provisioning_centos9.Id }} --partition-tables 'Kickstart default' + register: katello_provisioning_centos9_json - name: 'find kickstart templates' shell: > @@ -246,26 +246,26 @@ set_fact: katello_kickstart_templates: "{{ katello_kickstart_templates_json.stdout|from_json }}" -- name: 'associate kickstart templates to CentOS 7' +- name: 'associate kickstart templates to CentOS 9' shell: > - {{ katello_provisioning_hammer }} template add-operatingsystem --id {{ item.Id }} --operatingsystem 'CentOS 7' + {{ katello_provisioning_hammer }} template add-operatingsystem --id {{ item.Id }} --operatingsystem 'CentOS 9' with_items: "{{ kickstart_templates }}" -- name: 'set default templates for CentOS 7' +- name: 'set default templates for CentOS 9' shell: > - {{ katello_provisioning_hammer }} os set-default-template --id {{ katello_provisioning_centos7.Id }} --provisioning-template-id {{ item.Id }} + {{ katello_provisioning_hammer }} os set-default-template --id {{ katello_provisioning_centos9.Id }} --provisioning-template-id {{ item.Id }} with_items: "{{ kickstart_templates }}" -- name: 'overwrite default templates with katello specific ones for CentOS 7' +- name: 'overwrite default templates with katello specific ones for CentOS 9' shell: > - {{ katello_provisioning_hammer }} os set-default-template --id {{ katello_provisioning_centos7.Id }} --provisioning-template-id {{ item.Id }} + {{ katello_provisioning_hammer }} os set-default-template --id {{ katello_provisioning_centos9.Id }} --provisioning-template-id {{ item.Id }} with_items: "{{ katello_kickstart_templates }}" # Host group - name: 'find centos kickstart repo' shell: > {{ katello_provisioning_hammer }} --output=json repository info - --name "CentOS 7" + --name "CentOS 9" --product "CentOS" --organization "{{ katello_provisioning_organization }}" register: katello_provisioning_repo @@ -274,38 +274,38 @@ set_fact: katello_provisioning_repo_json: "{{ katello_provisioning_repo.stdout|from_json }}" -- name: 'find hostgroup Katello CentOS 7' +- name: 'find hostgroup Katello CentOS 9' shell: > - {{ katello_provisioning_hammer }} hostgroup info --name 'Katello CentOS 7' + {{ katello_provisioning_hammer }} hostgroup info --name 'Katello CentOS 9' register: katello_provisioning_hostgroup_katello_centos ignore_errors: True -- name: 'create Katello CentOS 7 host group' +- name: 'create Katello CentOS 9 host group' shell: > {{ katello_provisioning_hammer }} hostgroup create - --name "Katello CentOS 7" + --name "Katello CentOS 9" --content-view "Default Organization View" --lifecycle-environment Library --query-organization "{{ katello_provisioning_organization }}" --content-source-id {{ foreman_provisioning_smart_proxy.Id }} --kickstart-repository-id {{ katello_provisioning_repo_json.Id }} - --operatingsystem "CentOS 7" + --operatingsystem "CentOS 9" --partition-table 'Kickstart default' --parent 'Base' {{ foreman_provisioning_hammer_taxonomy_params }} when: katello_provisioning_hostgroup_katello_centos.stderr.find('not found') != -1 -- name: 'add activation key to Katello CentOS 7 host group' +- name: 'add activation key to Katello CentOS 9 host group' shell: > {{ katello_provisioning_hammer }} hostgroup set-parameter - --hostgroup "Katello CentOS 7" + --hostgroup "Katello CentOS 9" --name kt_activation_keys - --value "CentOS 7" + --value "CentOS 9" - name: 'set enable-puppet5 parameter' shell: > {{ katello_provisioning_hammer }} hostgroup set-parameter - --hostgroup "Katello CentOS 7" + --hostgroup "Katello CentOS 9" --name enable-puppet5 --value true diff --git a/vagrant/boxes.d/00-centos.yaml b/vagrant/boxes.d/00-centos.yaml index 2ef3930bc..fd8e80b15 100644 --- a/vagrant/boxes.d/00-centos.yaml +++ b/vagrant/boxes.d/00-centos.yaml @@ -1,25 +1,4 @@ boxes: - centos7: - box_name: 'centos/7' - google_options: - image_family: 'centos-7' - pty: true - scenarios: - - foreman - - katello - - centos7-atomic: - box_name: centos7-atomic - pty: true - libvirt: http://cloud.centos.org/centos/7/atomic/images/CentOS-Atomic-Host-7-Vagrant-Libvirt.box - - centos7-fips: - box_name: 'pulp/centos7-fips' - pty: true - scenarios: - - foreman - - katello - centos8: box_name: 'centos/8' disk_size: 40 diff --git a/vagrant/boxes.d/01-builtin.yaml b/vagrant/boxes.d/01-builtin.yaml index a2c892631..892969b17 100644 --- a/vagrant/boxes.d/01-builtin.yaml +++ b/vagrant/boxes.d/01-builtin.yaml @@ -1,23 +1,23 @@ boxes: - centos7-freeipa-server: - box: centos7 + centos9-freeipa-server: + box: centos9-stream memory: 2048 ansible: - playbook: 'playbooks/freeipa_server.yml' - group: 'freeipa_server' - server: 'centos7-katello-nightly' + playbook: "playbooks/freeipa_server.yml" + group: "freeipa_server" + server: "centos9-katello-nightly" - centos7-provision-nightly: - box: centos7 + centos9-provision-nightly: + box: centos9-stream memory: 8096 cpu_mode: host-passthrough ansible: playbook: - - 'playbooks/katello.yml' - - 'playbooks/katello_provisioning.yml' - group: 'server' + - "playbooks/katello.yml" + - "playbooks/katello_provisioning.yml" + group: "server" - centos7-luna: - box: centos7 + centos9-luna: + box: centos9-stream ansible: - playbook: 'playbooks/luna.yml' + playbook: "playbooks/luna.yml" diff --git a/vagrant/boxes.d/02-kubevirt.yaml b/vagrant/boxes.d/02-kubevirt.yaml index e29b8234c..f4f224431 100644 --- a/vagrant/boxes.d/02-kubevirt.yaml +++ b/vagrant/boxes.d/02-kubevirt.yaml @@ -1,5 +1,5 @@ -centos7-infra-kubevirt: - box: centos7 +centos9-infra-kubevirt: + box: centos9-stream cpu_mode: host-passthrough ansible: playbook: 'playbooks/kubevirt.yml' diff --git a/vagrant/boxes.d/99-local.yaml.example b/vagrant/boxes.d/99-local.yaml.example index 2ca62084d..06e3751ee 100644 --- a/vagrant/boxes.d/99-local.yaml.example +++ b/vagrant/boxes.d/99-local.yaml.example @@ -62,14 +62,6 @@ almalinux8-proxy-devel: group: 'foreman-proxy-content' server: 'almalinux8-katello-devel' -centos7-katello-client: - box: centos7 - ansible: - playbook: 'playbooks/katello_client.yml' - group: 'client' - variables: - katello_client_server: 'almalinux8-katello-devel' - almalinux8-katello-client: box: almalinux8 ansible: diff --git a/vagrant/config/versions.yaml b/vagrant/config/versions.yaml index 7c3b469bf..b8cf0ced2 100644 --- a/vagrant/config/versions.yaml +++ b/vagrant/config/versions.yaml @@ -5,8 +5,6 @@ installers: puppet: 7 boxes: - 'almalinux8' - - 'centos7' - - 'centos7-fips' - 'centos8' - 'centos8-stream' - 'debian10'