📌Why Configuration Management?
🔍 Scenario Overview: E-commerce Application Deployment
To deploy an e-commerce application, you need two Ubuntu Linux servers:
1. Database Server
Tasks to configure:
- Update Linux OS (
sudo apt update && sudo apt upgrade
) - Add necessary Linux users (
adduser
,usermod
) - Install PostgreSQL (
sudo apt install postgresql
) Configure PostgreSQL:
- Create a database
- Create and assign a database user
- Set proper authentication in
pg_hba.conf
2. Application Server
Tasks to configure:
- Update Linux OS
- Add necessary users
- Install Java (
sudo apt install default-jdk
) - Install Tomcat (download, extract, configure)
- Deploy application (typically WAR file to Tomcat webapps directory)
⚙️ Deployment Strategy
🌐 Deploying to Different Environments (e.g., ST, UAT, PROD)
When the application is updated, it must be re-deployed across all environments.
🧍 Manual Approach:
- Involves running all setup commands yourself
Drawbacks:
- Time-consuming
- Error-prone
- Not repeatable
🤖 Automated Approach:
- Faster, repeatable, and consistent
- Essential for scaling and maintaining multiple environments
🧰 Automation Methods
1. Procedural Automation (Scripted Approach)
- Describes how to do something, step-by-step
Example: Bash script to install Apache
sudo apt update sudo apt install apache2 -y sudo systemctl enable apache2 sudo systemctl start apache2
Pros:
- Simple and direct
Cons:
- Harder to maintain
- No built-in idempotence (re-running may cause issues)
2. Declarative Automation (Configuration Management)
- Describes the desired state, not the steps
- Tools interpret the desired state and bring the system to it
Example: Ansible/YAML to ensure Apache is:
- Installed
- Enabled
- Running
Benefits:
- Easy to read and manage
- Idempotent – same result on every execution
- Scalable across multiple machines
✅ What Is Configuration Management?
Configuration Management is software-based automation that:
- Configures systems declaratively
- Ensures idempotence
- Keeps system states consistent across environments
🛠 Popular Configuration Management Tools:
- Ansible
- Chef
- Puppet
- SaltStack
🧗 Steps to Learn Configuration Management with Ansible
Be Comfortable with Command Line
- Understand how to execute and troubleshoot shell commands
Manual Process First
- Know how to perform each step manually before automating
Learn YAML (Yet Another Markup Language)
- Ansible playbooks are written in YAML
Understand Ansible Concepts:
- Inventory
- Playbooks
- Tasks
- Modules
- Roles
Basic Linux Knowledge:
- Working with users, services, file permissions, package managers
🐧 Linux Basics
1. Kernel
- Core part of the OS
- Manages communication between hardware and software
2. Distributions
- OS variants built around the Linux kernel
- Add software and provide package managers
Popular Families:
Debian-based:
- Ubuntu
- Kali Linux
- Linux Mint
- Package Manager:
apt
Red Hat-based:
- Fedora
- RHEL (Red Hat Enterprise Linux)
- Amazon Linux
- Rocky Linux
- Package Manager:
yum
ordnf
3. Shell
- Interface between user and OS kernel
- Accepts and executes commands (e.g., Bash)
📝 Exercise: What is a Daemon in Linux?
A daemon is a background process that:
- Runs continuously
- Starts at boot or manually
- Provides services (e.g., web server, database)
Examples:
sshd
– SSH daemonhttpd
– Apache HTTP daemonpostgres
– PostgreSQL daemon
- Typically end with
d