The document discusses an automated process for deploying CloudStack using Ansible and AWX. Key components include OpenNebula OneFlow for infrastructure provisioning, Ansible playbooks for installing and configuring CloudStack, and AWX for orchestrating the process. The workflow provisions infrastructure, builds CloudStack from source, configures the management host, installs agents on hypervisor hosts, and performs initial configurations like zones and networks. Automating deployments eliminates errors, increases speed, and allows developers to self-service CloudStack instances.
1. CloudStack Collaboration Conference, November 14-16 2022, Sofia
Automated CloudStack Deployment
Kaloyan Kotlarski
CloudStack Collaboration Conference
2022
2. CloudStack Collaboration Conference, November 14-16 2022, Sofia
About me
● 26 years old
● System Administrator in the Technical Support team
● Picks up DevOps tasks to help Dev/Q&A teams
3. CloudStack Collaboration Conference, November 14-16 2022, Sofia
Why are we doing this?
● Need to have multiple CloudStack deployments because:
○ Devs need different versions of CS to work against
○ The solutions team needs CloudStack deployments for PoCs
● Eliminating errors during deployment
● Increasing speed of deployments
4. CloudStack Collaboration Conference, November 14-16 2022, Sofia
Why should deployments be automated?
● We want infrastructure to be provisioned in a cloud-native way so
that Devs can self-service them
● We want a Continuous Integration system to be able to provision
the CloudStack deployment for automated testing
5. CloudStack Collaboration Conference, November 14-16 2022, Sofia
The general picture
The things we need to have a complete self-service solution:
1. Infrastructure-as-Code solution - OpenNebula OneFlow
2. Configuration management system - Ansible
3. Automation Platform - AWX
6. CloudStack Collaboration Conference, November 14-16 2022, Sofia
Who is doing what?
● OneFlow: IaC via OpenNebula, provides compute instance and
virtual networks
● cloudstack-automation: Ansible playbook that deploys the
CloudStack management and hypervisor hosts. It also sets up initial
CloudStack configurations such as Zones, Pods, Clusters, etc.
● AWX: Orchestrates the entire process.
7. CloudStack Collaboration Conference, November 14-16 2022, Sofia
Why AWX?
● Provides a central place for managing Ansible automation
○ Stores and updates Inventory
○ Stores Credentials
○ Defines Job Templates: How a playbook should be run
○ Groups Job templates into Workflow templates
● Has API that can be called, providing an “Ansible Execution as a
Service”
● Provides Devs with self-service UI to trigger deployment
8. CloudStack Collaboration Conference, November 14-16 2022, Sofia
Workflow Steps
1. Spawns an OpenNebula OneFlow service
2. Performs initial host bootstrap
3. Builds CloudStack from source
4. Sets up an RPM repository so the rest of the hosts can install the packages
built in the previous step.
5. Installs all the prerequisites on the management host, i.e., MySQL database,
NFS exports
6. Installs CloudStack management package
7. Bootstraps CloudStack by performing database setup and downloading system
VM images.
8. Adds the configured Zones, Pods, Clusters, and Physical networks
9. Installs the CloudStack agent on hypervisor hosts
10. Configures networking and virtualization on the hypervisor hosts
11. Add the hypervisors to their respective Cluster.
12. Configure Primary and Secondary Storage
9. CloudStack Collaboration Conference, November 14-16 2022, Sofia
Details about step .3, “Builds CloudStack from
source.”
This step is mandatory for Dev & Testing setups because there is code
that isn’t available in the upstream pre-built packages. The playbook first
installs all required packages to build CloudStack. It then clones the
CloudStack repository using the specified version and runs the
packaging script provided in the repository. If no changes to the code
are detected, this step is skipped. Next, it sets up a yum repository (apt
and Debian-based support is on the way) and places the RPMs built
inside. Finally, the playbook adds the repository on all hosts participating
in the CloudStack deployment.
10. CloudStack Collaboration Conference, November 14-16 2022, Sofia
Details about step .7 “Bootstraps CloudStack by
performing database setup and downloading
system VM images.”
This step creates and populates the MySQL database. After settling the
database, the playbook creates an empty file to indicate that the
population was successful and should be skipped the next the playbook
is executed. Then, it calls CloudStack setup tools to download the
system VM images and finalize the bootstrap of the management
service. All tasks are idempotent.
11. CloudStack Collaboration Conference, November 14-16 2022, Sofia
Details about step .8 “Adds the configured Zones,
Pods, Clusters, and Physical networks”
This step performs the initial configuration steps. It downloads the CLI
client, creates a user API key and secret, and stores them as Ansible
facts. It uses the API details to issue API calls to the management
service to create configured Zones, Pods, Clusters, and Primary
networks. The calls to the API are idempotent.
14. CloudStack Collaboration Conference, November 14-16 2022, Sofia
Interested to know more?
Get in touch with us!
https://github.com/storpool/cloudstack-automation
info@storpool.com
www.storpool.com