Ansible contd
Installing spc on redhat 9
- Manual steps
sudo dnf install java-17-openjdk -y
# for rest of steps refer previous classroom notes
- Refer Here for the changes done to accomodate the redhat support
Accomodating changes in values
- For instance, few months down the line i might need to install java 21 or the username should be something else or url etc
- In ansible we can create variables.
- Variables can be passed at runtime and also can have default values if not passed
- Ansible allows to create variables at multiple locations (TBD)
- Refer Here for offical docs
- debug module Refer Here
Variables in inventory
- Generally when we define variables at inventory we have two types of variables
- host variables:
- group variables:
- Refer Here for a host level varaible defined in inventory
- Updated the playbook to use generic package manager Refer Here
- Refer Here for the changes to use group variables
- Ansible provides a better way for creating host and group variables by using host_vars directory and group_vars directory,
- Refer Here for the changes
Good Practice
- Ensure you add necessary debug statements to inform users about activities
Templating
- Ansible uses jinja templates to handle dynamic content in files Refer Here
