Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions breakfix1/README.md → SCENARIO_LEAPP/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
breakfix1
breakfix0/SCENARIO_LEAPP
=========

This role targets to break a satellite and capsule server in a way that, neither hosts will be able to download patches from them nor any repos can be successully resynced on the satellite.

Example Error:

Status code: 500 when trying to install\update packages on the RHEL systems connected with the satellite server through a capsule server.

~~~
[MIRROR] katello-host-tools-4.2.3-5.el8sat.noarch.rpm: Status code: 500 for https://capsule.example.com/pulp/content/RedHat/Library/content/dist/layered/rhel8/x86_64/sat-client/6/os/Packages/k/katello-host-tools-4.2.3-5.el8sat.noarch.rpm (IP: XX.XX.XXX.XXX)
~~~
This role registers a RHEL8 client to satellite and simulates few problems while performing the LEAPP upgrade to RHEL9.

What we essentially do by this ansible role is:

* Confirm that the satellite is running
* Create an activation key
* Generate a registration command [ via Global registration method ] to register a host through the external capsule server
* Create and publish content view without the RHEL9 minor repos
* Generate a registration command [ via Global registration method ] to register the client to satellite
* Execute the command on the client and register it
* Update database records of satellite and capsule to break them.
* Configure EPEL on client and install openssl rpms from it.


Requirements
Expand All @@ -41,12 +34,12 @@ Example Playbook
This ansible role can be executed after creating a playbook in the following way.

~~~
# cat breakfix1.yaml
# cat breakfix0.yaml
---
- name: Deploy ansible role breakfix1 on target systems
- name: Deploy ansible role breakfix0 on target systems
hosts: satellite
roles:
- role: breakfix1
- role: breakfix0
tags: break
~~~

Expand All @@ -58,4 +51,4 @@ It is free software licensed under the terms of the GNU General Public License G
Author Information
------------------

This role is developed by Sayan Das <saydas@redhat.com>, <connectwithsayan03@gmail.com>.
This role is developed by Soham Majumdar <smajumda@redhat.com>, <csedeepm@gmail.com>.
6 changes: 6 additions & 0 deletions SCENARIO_LEAPP/breakfix0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Deploy ansible role breakfix1 on target systems
hosts: satellite
roles:
- role: breakfix0
tags: break
105 changes: 105 additions & 0 deletions SCENARIO_LEAPP/breakfix0/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
# tasks file for breakfix0
- name: Set initial facts
ansible.builtin.set_fact:
satellite_hostname: "{{ ansible_fqdn }}"

- name: Read credentials
ansible.builtin.slurp:
path: /root/.hammer/cli.modules.d/foreman.yml
register: slurp

- name: Set credentials
set_fact:
password: "{{ (slurp.content | b64decode | from_yaml)[':foreman'][':password'] }}"
username: "{{ (slurp.content | b64decode | from_yaml)[':foreman'][':username'] }}"


- name: Ensure satellite is running.
theforeman.foreman.status_info:
server_url: "https://{{ satellite_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
validate_certs: false
register: status_info

- name: "Create or update leapp content view"
theforeman.foreman.content_view:
username: "{{ username }}"
password: "{{ password }}"
server_url: "https://{{ satellite_hostname }}"
name: "leapp_8to9"
organization: "{{ satellite_organization }}"
repositories:
- name: 'Red Hat Enterprise Linux 9 for x86_64 - AppStream RPMs 9'
product: 'Red Hat Enterprise Linux for x86_64'
- name: 'Red Hat Enterprise Linux 9 for x86_64 - BaseOS RPMs 9'
product: 'Red Hat Enterprise Linux for x86_64'
- name: 'Red Hat Enterprise Linux 8 for x86_64 - AppStream RPMs 8'
product: 'Red Hat Enterprise Linux for x86_64'
- name: 'Red Hat Enterprise Linux 8 for x86_64 - BaseOS RPMs 8'
product: 'Red Hat Enterprise Linux for x86_64'

- name: "Publish the leapp content view"
theforeman.foreman.content_view_version:
username: "{{ username }}"
password: "{{ password }}"
server_url: "https://{{ satellite_hostname }}"
content_view: "leapp_8to9"
organization: "{{ satellite_organization }}"


- name: Create client activation key
theforeman.foreman.activation_key:
server_url: "https://{{ satellite_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
validate_certs: false
name: "{{ activation_key }}"
organization: "{{ satellite_organization }}"
lifecycle_environment: "Library"
content_view: "leapp_8to9"
when: status_info['status']['result'] == "ok"
register: ak_created

- name: Create EPEL repo on client
ansible.builtin.yum_repository:
name: epel
description: EPEL YUM repo
baseurl: https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/
gpgcheck: no
delegate_to: "{{ groups['client'][0] }}"

- name: Install openssl3
ansible.builtin.dnf:
name: openssl3
state: present
delegate_to: "{{ groups['client'][0] }}"




- name: Generate registration command to register the system with Satellite server
theforeman.foreman.registration_command:
server_url: "https://{{ satellite_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
validate_certs: false
setup_remote_execution: true
setup_insights: false
jwt_expiration: 8
force: true
insecure: true
activation_keys: "{{ activation_key }}"
organization: "{{ satellite_organization }}"
location: "{{ satellite_location }}"
# smart_proxy: "{{ groups['capsule'][0] }}"
when: ak_created is success
register: global_reg_command

- name: Regsiter the client host
ansible.builtin.command: bash -c "{{ global_reg_command['registration_command'] }}"
delegate_to: "{{ groups['client'][0] }}"
register: host_registration
when: global_reg_command is defined

5 changes: 5 additions & 0 deletions SCENARIO_LEAPP/breakfix0/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
# vars file for breakfix1
satellite_organization: "Default Organization"
satellite_location: "Default Location"
activation_key: "RHEL-AK"
13 changes: 13 additions & 0 deletions SCENARIO_LEAPP/grade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- name: Grading playbook for SCENARIO_LEAPP
hosts: rhel81
tasks:
- name: Detecting result
ansible.builtin.debug:
msg: "Success. your alphanumeric code for completion is RHEL9"
when: ansible_facts['distribution_major_version'] == "9"

- name: In case of failure
ansible.builtin.debug:
msg: "The system is not upgraded successfully yet, please try again."
when: ansible_facts['distribution_major_version'] != "9"
7 changes: 7 additions & 0 deletions SCENARIO_LEAPP/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
collections:
- name: https://github.com/theforeman/foreman-ansible-modules.git
type: git
version: develop
- name: ansible.posix
- name: community.general
50 changes: 50 additions & 0 deletions SCENARIO_PERFORMANCE/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
breakfix2/SCENARIO_PERFORMANCE
=========

This role breaks the satellite by setting some large values to few of the satellite params.

What we essentially do by this ansible role is:

* Confirm that the satellite is running
* Set large values to puma max min threads, puma workers, foreman db pool, pulpcore workers


Requirements
------------

This ansible role requires the [foreman ansible modules](https://github.com/theforeman/foreman-ansible-modules/). Please install them before executing the role.

Role Variables
--------------

The `vars/main.yml` file contains the required variables for the ansible role. Adjust the values according to your environment.

Dependencies
------------

NA

Example Playbook
----------------

This ansible role can be executed after creating a playbook in the following way.

~~~
# cat breakfix2.yaml
---
- name: Deploy ansible role breakfix2 on target systems
hosts: satellite
roles:
- role: breakfix2
tags: break
~~~

License
-------

It is free software licensed under the terms of the GNU General Public License GPL v3 or later. A copy of the license can be obtained here: http://www.gnu.org/licenses/gpl-3.0.html

Author Information
------------------

This role is developed by Soham Majumdar <smajumda@redhat.com>, <csedeepm@gmail.com>.
7 changes: 7 additions & 0 deletions SCENARIO_PERFORMANCE/breakfix2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Deploy ansible role breakfix1 on target systems
hosts: satellite
roles:
- role: breakfix2
tags: break

45 changes: 45 additions & 0 deletions SCENARIO_PERFORMANCE/breakfix2/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
# tasks file for breakfix2
- name: Set initial facts
ansible.builtin.set_fact:
satellite_hostname: "{{ ansible_fqdn }}"

- name: Read credentials
slurp:
path: /root/.hammer/cli.modules.d/foreman.yml
register: slurp

- name: Set credentials
set_fact:
password: "{{ (slurp.content | b64decode | from_yaml)[':foreman'][':password'] }}"
username: "{{ (slurp.content | b64decode | from_yaml)[':foreman'][':username'] }}"


- name: Ensure satellite is running.
theforeman.foreman.status_info:
server_url: "https://{{ satellite_hostname }}"
username: "{{ username }}"
password: "{{ password }}"
validate_certs: false
register: status_info

- name: Breaking foreman_service_puma_threads_min
shell: "sed -i 's/foreman_service_puma_threads_min:/foreman_service_puma_threads_min: 300/' /etc/foreman-installer/scenarios.d/satellite-answers.yaml"
- name: Breaking foreman_service_puma_threads_max
shell: "sed -i 's/foreman_service_puma_threads_max: 5/foreman_service_puma_threads_max: 300/' /etc/foreman-installer/scenarios.d/satellite-answers.yaml"
- name: Breaking s/foreman_service_puma_workers
shell: "sed -i 's/foreman_service_puma_workers:/foreman_service_puma_workers: 120/' /etc/foreman-installer/scenarios.d/satellite-answers.yaml"
- name: Breaking db_pool
shell: "sed -i 's/db_pool:/db_pool: 300/' /etc/foreman-installer/scenarios.d/satellite-answers.yaml"
- name: Breaking pulpcore_worker_count
shell: "sed -i 's/pulpcore_worker_count: 8/pulpcore_worker_count: 10/' /etc/foreman-installer/scenarios.d/satellite-answers.yaml"

- name: Fair Warning
debug:
msg: The next task will probably run for 8-10 mins and may end in error. But its expected.

- name: Breaking satellite
shell: "satellite-installer"
ignore_errors: true


6 changes: 6 additions & 0 deletions SCENARIO_PERFORMANCE/breakfix2/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# vars file for breakfix1
satellite_organization: "Default Organization"
satellite_location: "Default Location"
activation_key: "RHEL-AK"

46 changes: 46 additions & 0 deletions SCENARIO_PERFORMANCE/grade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
- name: Grading playbook for SCENARIO_PERFORMANCE
hosts: satellite
gather_facts: yes
tasks:
- name: Reading answers file using slurp
slurp:
path: /etc/foreman-installer/scenarios.d/satellite-answers.yaml
register: answers_file

- name: Extracting puma_thread_max_min puma_worker db_pool pulp_worker
set_fact:
puma_thread_max: "{{ (answers_file.content | b64decode | from_yaml)['foreman']['foreman_service_puma_threads_max'] }}"
puma_thread_min: "{{ (answers_file.content | b64decode | from_yaml)['foreman']['foreman_service_puma_threads_min'] }}"
puma_worker: "{{ (answers_file.content | b64decode | from_yaml)['foreman']['foreman_service_puma_workers'] }}"
db_pool: "{{ (answers_file.content | b64decode | from_yaml)['foreman']['db_pool'] }}"
pulp_worker: "{{ (answers_file.content | b64decode | from_yaml)['foreman_proxy_content']['pulpcore_worker_count'] }}"

- name: Reading last_scenario
slurp:
path: /etc/foreman-installer/scenarios.d/last_scenario.yaml
register: last_scenario

- name: Extracting tuning_profile
set_fact:
tuning_profile: "{{ (last_scenario.content | b64decode | from_yaml)[':facts']['tuning'] }}"

- name: Displaying what is being captured
debug:
msg: puma_thread_max is "{{ puma_thread_max }}" | puma_thread_min is "{{ puma_thread_min }}" | puma_worker is "{{ puma_worker }}" | db_pool is "{{ db_pool }}" | pulp_worker is "{{ pulp_worker }}" | tuning_profile is "{{ tuning_profile }}"

- name: Checking result
ansible.builtin.debug:
msg: Success. your alphanumeric code for completion is PERFORMANCE
when:
- puma_thread_max == "16"
- puma_thread_min == "16"
- ( puma_worker | float >= 8 and puma_worker | float <= 12 )
- db_pool == "16"
- pulp_worker == "8"
- tuning_profile == "medium"

- name: In case of failure
ansible.builtin.debug:
msg: "The satellite is not tuned correctly, please try again."
when: db_pool != "16" or tuning_profile != "medium" or puma_thread_max != "16" or puma_thread_min != "16" or pulp_worker != "8" or ( puma_worker | float != 12 and puma_worker | float != 11 and puma_worker | float != 10 and puma_worker | float != 9 and puma_worker | float != 8 )
7 changes: 7 additions & 0 deletions SCENARIO_PERFORMANCE/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
collections:
- name: https://github.com/theforeman/foreman-ansible-modules.git
type: git
version: develop
- name: ansible.posix
- name: community.general
Loading