Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

clean_rhsm role #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
44 changes: 44 additions & 0 deletions roles/clean_rhsm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Ansible Role for Cleaning up RHSM
==================================

This Ansible role removes Candlepin certs and sets RHSM config file to its default state.

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

No Requirements are required for this role.

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

No variables required for this role.

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

This role is not dependent upon any galaxy roles.

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

Here is a simple example of clean_rhsm role:

- hosts: localhost
remote_user: root
roles:
- clean_rhsm

License
-------

GNU GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc.


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

This is developed by Satellite QE team, irc: #robottelo on Freenode
2 changes: 2 additions & 0 deletions roles/clean_rhsm/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
rhsm_conf: /etc/rhsm/rhsm.conf
21 changes: 21 additions & 0 deletions roles/clean_rhsm/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
# Standards: 0.2
galaxy_info:
author: Satellite QE Team
description: Satellite QE Team
company: Red Hat

license: GPLv3

min_ansible_version: 2.5.0

platforms:
- name: RHEL
versions:
- 7
- 6

galaxy_tags: []


dependencies: []
38 changes: 38 additions & 0 deletions roles/clean_rhsm/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
- name: "Erase existing Candlepin certs, if any."
yum:
name: katello-ca-consumer-*
state: absent

- name: Erase katello-server-ca.pem
file:
path: /etc/rhsm/ca/katello-server-ca.pem
state: absent

- name: "Change 'hostname' to 'subscription.rhsm.redhat.com'"
ini_file:
path: "{{ rhsm_conf }}"
section: server
option: hostname
value: subscription.rhsm.redhat.com

- name: "Change 'prefix' to '/subscription'"
ini_file:
path: "{{ rhsm_conf }}"
section: server
option: prefix
value: /subscription

- name: "Change baseurl to 'https://cdn.redhat.com'"
ini_file:
path: "{{ rhsm_conf }}"
section: rhsm
option: baseurl
value: https://cdn.redhat.com

- name: "Change repo_ca_cert to '%(ca_cert_dir)sredhat-uep.pem'"
ini_file:
path: "{{ rhsm_conf }}"
section: rhsm
option: repo_ca_cert
value: "%(ca_cert_dir)sredhat-uep.pem"
2 changes: 2 additions & 0 deletions roles/clean_rhsm/tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[sat63]
sat63-rhel7 ansible_ssh_host=sat63-rhel7.example.com ansible_user=root
4 changes: 4 additions & 0 deletions roles/clean_rhsm/tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- hosts: sat63
roles:
- clean_rhsm