Ansible
Automated provisioning and configuration of Ansible controllers and workers.
Commands: dob ansible config, dob ansible attach-worker
This feature introduces automated provisioning and configuration of Ansible controllers and workers, including both manager and worker nodes. The setup involves creating EC2 instances, configuring Ansible, and managing inventory files.
Key Highlights:
- Ansible Commands Group
- Command Group: ansible
- Description: Introduces a command group for managing and configuring Ansible controllers and workers in a DevOps environment using YAML-based configuration files.
- Supported Commands:
- Setup Ansible Controller
- Command: dob ansible config --file-path <path>
- Description: Provisions a new Ansible controller instance on AWS, configures SSH access, installs Ansible, and prepares the ansible.cfg and inventory file. Supports custom configuration via YAML.
- Attach New Workers
- Command: dob ansible attach-worker --file-path <path>
- Description: Attaches new worker nodes to an existing Ansible controller. Automatically provisions new instances, distributes SSH keys, configures inventory, and performs a connectivity check using the ansible ping module.
- Setup Ansible Controller
Key Features:
- YAML-Driven Configuration
- Allows users to specify controller and worker configurations, including:
- AMI ID
- Instance type
- Security group
- Key pair name
- Inventory path
- Custom Ansible configurations
- Automated Ansible Installation
- Detects the operating system and installs the correct Ansible version and dependencies on the controller.
- Dynamic SSH Key Management
- Automatically generates and distributes SSH keys to ensure secure communication between the controller and workers.
- Inventory Management
- Dynamically creates and updates the inventory file on the controller with new worker nodes.
- Error Handling and Validation
- Comprehensive error handling for instance provisioning, SSH key distribution, and command execution.
Example YAML Configuration:
controller:
name: ansible-controller
instance_type: t2.medium
key_name: my-ssh-key
security_group: my-security-group
workers:
name: ansible-worker
instance_type: t2.small
key_name: my-ssh-key
security_group: my-security-group
count: 3
Example Usage:
dob ansible config --file-path /path/to/config.yaml
dob ansible attach-worker --file-path /path/to/new-workers-config.yaml