ogerbron.satellite6_content_views
Content View Management with Ansible
Note: I'm no longer using Red Hat Satellite due to a job change, which means I can't maintain this role well and don't have a Satellite license. Feel free to contribute with improvements or create your own version. Enjoy!
What is it?
The satellite6-content_views is an Ansible role that helps you manage content views in Red Hat Satellite 6.x. You can do things like:
- Publish a new version of a content view
- Promote a version to a specific environment
- Delete older versions
This role interacts with the Red Hat Satellite HTTP API.
Prerequisites
To use this role, you need:
- Ansible version 2.0 or higher
- Red Hat Satellite 6.x
- HTTPS access from your Ansible machine to Satellite
- A Satellite user with admin privileges
Getting Started
Here are some example playbooks to help you use this role.
Publish a New Version
This example will publish a new version of a specific content view:
---
- hosts: localhost
connection: local
vars:
sat_hostname: satelliteurl.example.com
sat_user: satellite_user
sat_password: satellite_password
sat_org: satellite_organization
sat_cv_name: content_view_name
roles:
- satellite6-content_views
Note: This updates "composite" content views before publishing.
Publish and Promote a Content View
To publish a new version and promote it to an environment named satellite_env
:
---
- hosts: localhost
connection: local
vars:
sat_hostname: satelliteurl.example.com
sat_user: satellite_user
sat_password: satellite_password
sat_org: satellite_organization
sat_cv_name: content_view_name
sat_promote: yes
sat_env_name: satellite_env
roles:
- satellite6-content_views
By default, it promotes the content view through each environment in the path until it reaches sat_env_name
.
Only Promote a Content View
To promote the latest version of a content view to satellite_env
without publishing a new version:
---
- hosts: localhost
connection: local
vars:
sat_hostname: satelliteurl.example.com
sat_user: satellite_user
sat_password: satellite_password
sat_org: satellite_organization
sat_cv_name: content_view_name
sat_publish: no
sat_promote: yes
sat_env_name: satellite_env
roles:
- satellite6-content_views
Remove Old Content Views
To delete older content views and keep only a set number:
---
- hosts: localhost
connection: local
vars:
sat_hostname: satelliteurl.example.com
sat_user: satellite_user
sat_password: satellite_password
sat_org: satellite_organization
sat_cv_name: content_view_name
sat_publish: no
sat_remove_old_cv: yes
sat_keep_old_cv: 5
roles:
- satellite6-content_views
Role Variables
Here's a list of variables for this role:
Variable Name | Required | Default | Description |
---|---|---|---|
sat_hostname |
yes | None | URL or IP of Satellite |
sat_user |
yes | None | Satellite admin username |
sat_password |
yes | None | Password for the Satellite user |
sat_org |
yes | None | Organization name in Satellite |
sat_cv_name |
yes | None | Name of the content view to publish |
sat_publish |
no | yes | Set to "yes" to publish a new version |
sat_remove_old_cv |
no | no | Set to "yes" to delete old content views |
sat_keep_old_cv |
no | 5 | Number of old versions to keep |
sat_promote |
no | no | Set to "yes" to promote content to a specified env |
sat_env_name |
no | None | Environment to promote to |
sat_wait_task_retries |
no | 60 | Number of retry attempts for tasks |
sat_wait_task_delay |
no | 30 | Delay between task checks |
Future Improvements
- Publish all content views at once
- Promote specific versions of a content view
- Publish only if there are new packages
- Optimize task searches
- Add more tests
License
GPLv3
Author
Olivier Gerbron
Role to manage content views in RedHat Satellite
ansible-galaxy install ogerbron.satellite6_content_views