Kubernetes Load Balancer Configuration Automation

This script automates the configuration of Kubernetes Load Balancers using a combination of Ansible and Python scripting.

How It Works

This automation tool leverages the power of Ansible for configuration and Python to centralize and substitute the values that need to be changed. Here's a step-by-step overview of how the script operates:

  1. Backup Configuration Files:

    • The script initiates by creating backups of all configuration files, storing them in a tmp folder. This safeguard ensures that the original configuration can be restored if needed.
  2. Value Substitution:

    • Python is used to replace specific values in the configuration files with data from the variable.py file. This centralizes and simplifies the process of making configuration changes.
  3. Ansible Playbook Execution:

    • The script runs the Ansible playbook initial.yaml by executing the command ansible-playbook initial.yaml -i inventory.yaml. This step automates the configuration of your Kubernetes Load Balancers based on the updated configuration files.
  4. Revert Configuration Files:

    • After the Ansible playbook has executed, the script restores the original configuration by replacing the modified files with the backups stored in the tmp folder.

How to Use This Script

Follow these steps to leverage this automation script for your Kubernetes Load Balancer configuration:

  1. Prepare Your Variables:

    • Create a variable.py file based on the provided variable.example.py. Customize this file with the values that match your specific use case.
  2. Execute the Script:

    • Run the script using Python 3:
      python3 script.py
      
  3. Automation Completion:

    • The script will take care of the entire configuration process, automating the backup, substitution, and Ansible playbook execution.
  4. Voila!:

    • Your Kubernetes Load Balancer configuration is now automated and in sync with your customized variables.

This README provides an overview of the script's purpose and usage, enabling you to streamline your Kubernetes Load Balancer configuration process. Feel free to improve this script by opening issues or creating pull requests. Your feedback and contributions are highly welcome!