This script converts Red Hat Satellite 5 configuration channels to ansible roles.
To use the script, follow these steps:
- Install the requirements by running
yum install spacewalk-utils
andpip install -r requirements.txt
. - Dump the desired configuration channel(s) from Satellite 5 to a JSON file using the command
spacewalk-export --channel channel_name --output-file file.json
. - Activate the virtual environment by running
source venv/bin/activate
. - Run the script using the command
python sat5cfg2ansible.py <path_to_json_files>
. - The script will output the generated ansible roles and playbooks to the
<path_to_json_files>/transformed_files
directory.
The following requirements are necessary to use this script:
- spacewalk-utils: This package is required to export configuration data from Red Hat Satellite 5.
- libmagic C library: This library is required for the python-magic package, which is used to identify the file type of the dumped JSON data. See the python-magic documentation (https://pypi.org/project/python-magic/) for installation instructions.
This script can also be run using a container image.
To build the container image, run the following command:
podman build -t sat5cfg .
To convert the JSON files using the container, run the following command:
Copy code
podman run -it -v <path_to_local_files>:/data:Z sat5cfg
This will mount the local files at <path_to_local_files>
to the /data
directory in the container, and then run the container using the sat5cfg
image.
- Make sure to replace
<path_to_local_files>
with the actual path to the local JSON files that you want to convert. - The
:Z
flag is required to allow the container to access the files with the correct SELinux labels.