This guide outlines the modernization of the OpenStack DevOps Suite, replacing the previous Ansible-only approach with a modern Infrastructure as Code (IaC) and Configuration Management setup.
| Before | After | Benefits |
|---|---|---|
| Ansible-only deployment | Terraform + Ansible | Infrastructure as Code, state management |
| Manual SCM | GitLab CE | Modern Git workflows, integrated CI/CD |
| Manual orchestration | GitLab CI/CD pipelines | Automated deployment, rollback capabilities |
| Single-tool approach | Best-of-breed tools | Each tool optimized for its purpose |
Old Architecture:
┌─────────────┐
│ Ansible │ ──→ OpenStack ──→ Configure Everything
└─────────────┘
New Architecture:
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Terraform │ ──→│ OpenStack │ │ Ansible │
│ (Provision) │ │(Infra Layer)│ ──→│ (Configure) │
└─────────────┘ └─────────────┘ └─────────────┘
│
┌─────────────┐
│ GitLab CI/CD│
│(Orchestrate)│
└─────────────┘
-
Terraform (>= 1.0)
# macOS brew install terraform # Linux wget https://releases.hashicorp.com/terraform/1.6.0/terraform_1.6.0_linux_amd64.zip unzip terraform_1.6.0_linux_amd64.zip sudo mv terraform /usr/local/bin/
-
Ansible (>= 6.x)
pip install ansible
-
OpenStack CLI (configured)
pip install python-openstackclient source openstack-rc.sh # Your OpenStack credentials
-
jq (for JSON processing)
# macOS brew install jq # Linux sudo apt install jq
# Clone the repository
git clone <repository-url>
cd openstack-devops-suite
# Set up environment
export GITLAB_ROOT_PASSWORD="YourSecurePassword123!"
source your-openstack-rc.sh
# Deploy everything
./scripts/deploy.sh deploy-
Plan Infrastructure
./scripts/deploy.sh plan
-
Deploy Infrastructure and Services
./scripts/deploy.sh deploy
-
Access Services
- Dashboard:
http://<nginx-ip> - GitLab:
http://<gitlab-ip>:8090(Primary CI/CD and SCM)
- Dashboard:
openstack-devops-suite/
├── terraform/ # Infrastructure as Code
│ ├── main.tf # Main Terraform configuration
│ ├── variables.tf # Input variables
│ ├── outputs.tf # Output values
│ └── templates/ # Terraform templates
├── roles/ # Ansible roles
│ ├── gitlab_scm/ # GitLab role for Git SCM and CI/CD
│ └── ... # Other service roles
├── playbooks/ # Ansible playbooks
│ ├── site.yml # Main deployment playbook
│ ├── gitlab.yml # GitLab deployment
│ └── ... # Individual service playbooks
├── .gitlab-ci.yml # GitLab CI/CD pipeline
└── scripts/
└── deploy.sh # Deployment orchestration script
Edit terraform/terraform.tfvars:
# OpenStack Configuration
auth_url = "https://your-openstack:5000/v3"
username = "your-username"
password = "your-password"
project_name = "your-project"
# Infrastructure Settings
environment_name = "devops"
image_name = "Ubuntu 22.04"
flavor_name = "m1.medium"
external_network_name = "public"The GitLab role supports extensive configuration:
# In roles/gitlab_scm/defaults/main.yml
gitlab_external_url: "http://{{ ansible_default_ipv4.address }}:8090"
gitlab_root_password: "ChangeMe123!"
gitlab_registry_enable: true
gitlab_pages_enabled: falseThe included Jenkinsfile provides:
- Validation: Terraform and Ansible syntax checking
- Planning: Infrastructure change planning
- Deployment: Automated infrastructure provisioning and configuration
- Verification: Service health checks
- validate: Syntax checking and validation
- plan: Infrastructure planning
- infrastructure: Resource provisioning
- configure: Service configuration
- verify: Health checks and validation
- cleanup: Manual cleanup jobs
After deployment, services are available at:
- Dashboard:
http://<nginx-ip>- Central dashboard - GitLab:
http://<gitlab-ip>:8090- Git SCM and CI/CD (Primary Platform) - Nexus:
http://<nexus-ip>:8081- Artifact repository - Keycloak:
http://<keycloak-ip>:8180- Identity management - Rancher:
http://<rancher-ip>:8443- Kubernetes management
The deployment script includes verification steps:
# Check all services
./scripts/deploy.sh deploy
# Services are automatically verified during deployment-
Terraform State Issues
cd terraform terraform refresh terraform plan -
Ansible Connection Issues
ansible all -i inventory/terraform-hosts.yml -m ping
-
Service Not Starting
# Check service logs ansible <service>_servers -i inventory/terraform-hosts.yml -a "systemctl status <service>"
-
Configuration Rollback
# Re-run specific playbook ansible-playbook -i inventory/terraform-hosts.yml playbooks/<service>.yml
-
Infrastructure Rollback
cd terraform terraform plan -destroy terraform destroy
-
Export Legacy Data
- Export Git repositories from legacy systems
- Export project data and documentation
- Export user accounts and permissions
-
Import to GitLab
- Create projects in GitLab
- Import Git repositories
- Configure users and permissions
-
Update CI/CD Pipelines
- Migrate to GitLab CI/CD
- Update webhook configurations
- Test automated builds
The modernized setup uses gitlab_scm for Git SCM management:
- roles:
- - legacy_scm
+ roles:
+ - gitlab_scm- Customize Configuration: Adapt variables to your environment
- Set Up Monitoring: Configure additional monitoring tools
- Enable SSL: Configure SSL certificates for production
- Backup Strategy: Implement automated backups
- Security Hardening: Apply security best practices
For questions or issues, please refer to the project documentation or open an issue in the repository.