Infrastructure as code - Supported tools

Deploy
Rémy Léone
8 min read

We will see what kind of infrastructure as code tooling you can use with your Scaleway resources.

As we have seen in the first article, infrastructure as code allows you to define your infrastructure as a code in a given language. Those tools usually support several vendors. This helps users to adapt quickly to a new setup with a new provider while keeping the same development methodology.

Vendor supports can vary depending on the tool you use. In this article, we will focus on the most widespread infrastructure as code tool that Scaleway natively supports. For each of these tools, we will link several tutorials to help you get started and quickly gain knowledge on them.

All the tools we present work on the most common platforms, such as Linux, macOS, Windows, FreeBSD, and NetBSD.

Ansible

Ansible is a very versatile tool used to provision and perform actions on a set of machines. Ansible works by providing modules that will execute tasks on a remote target. Those tasks can be executed in a sequence to perform complex actions such as configuring a complete software stack on a remote host.

Product Modules

Ansible ships many modules that connect directly with our APIs to provide infrastructure automation inside your Ansible playbooks.

At the moment, the latest Ansible version supports:

Scaleway service
Related Ansible module
Instance
scaleway_compute – Scaleway compute management module
Flexible IP
scaleway_ip – Scaleway IP management module
Scaleway Load Balancer
scaleway_lb – Scaleway load-balancer management module
Security Group
scaleway_security_group – Scaleway Security Group management module
Security Group rules
scaleway_security_group_rule – Scaleway Security Group Rule management module
Authorized SSH keys
scaleway_sshkey – Scaleway SSH keys management module
Metadata API
scaleway_user_data – Scaleway user_data management module
Scaleway Volumes
scaleway_volume – Scaleway volumes management module

These modules perform actions on your Scaleway resources. Sometimes in your playbook, you don't want to modify anything, but instead, want to fetch data to inject it in Ansible tasks. That's where facts modules come in. These modules are designed to fetch the information from Scaleway APIs and make them available inside your tasks. For instance, you can fetch the IP instances attached to an instance to configure a particular application.

Ansible facts module
Description
Gather facts about the Scaleway security groups available
Gather facts about the Scaleway images available
Gather facts about the Scaleway IPs available
Gather facts about the Scaleway volumes available
Gather facts about the Scaleway servers available
Gather facts about the Scaleway snapshots available
Gather facts about the Scaleway organizations available

Inventory

Inventory is a core concept of Ansible. It allows you to define a large host set that can be a target for the execution of a set of tasks. Inventories can have many forms. They can be a static file that contains a host list, but they can also be a plugin that will execute code and return data about a set of hosts. This is particularly useful in a cloud environment where resources are very elastic and dynamic.

Scaleway inventory plugin brings you these features. This plugin fetches your resources from our APIs and presents them to you in an Ansible compatible format. It can also perform filter operation on tags and regions so you can execute on a fine-grained host set.

Evolution of Ansible support

As you can see, Scaleway's support in Ansible is widespread and encompasses many useful features. You can have a complete provisioning stack with Ansible that can install your application on Scaleway infrastructures natively.

Ansible is on the Scaleway roadmap for active support! We plan to have a Python SDK generated just like our golang SDK. This would allow us to add support very easily to new products with any tool written in Python.

Packer

Packer creates machine images for multiple platforms from a single source configuration file. It can build images for multiple cloud providers platforms, including Scaleway.

This tool is typically used to build a reference image (like a golden image) that has an environment ready to run your application. Packer can run multiple provisioners, including Ansible. By doing so, you can combine both tools to have images that are fully managed by code.

You can find tutorials on our website about how to deploy your image using Packer.

We want to migrate Packer to use our new go SDK.

Terraform

Terraform is a popular tool to spawn entire infrastructure with code. Scaleway has been involved with Terraform for a long time. We wanted to keep investing in this tool due to its massive and popular adoption.

We are currently refactoring our Terraform provider to use our refactored SDK. This will help us to provide native support for new products quickly. This SDK uses resources' definition written as protobuf to streamline our development.

Kubernetes

Kubernetes is a container orchestration solution that recently gained a tremendous amount of adoption. You can use Kubernetes to fully manage your infrastructures and application lifecycle.

Kubernetes is built around the idea of having the desired state for your infrastructure matching the observed state of your infrastructure. In Kubernetes, your application is described by a set of objects that make up your application (LoadBalancer configuration, number of replicas, placement on specific nodes, …). This declarative paradigm is the same that we use in other infra as code tools.

Scaleway provides you with a managed Kubernetes. You can use this service to have a managed Kubernetes cluster upon which your application will be deployed.
If you prefer to manage your cluster yourself, you can use a solution such as Kubeadm to deploy your Kubernetes cluster on Scaleway.

As for the roadmap, we will release our cloud controller manager (CCM) soon.

Conclusion

Scaleway natively supports a wide range of Infrastructure as code use cases.
Using infra as code allows you to benefit from versioning, code reviews, and reproducibility, to name a few.

There are many other options available to control your resources: we got a command-line interface, a web console, and REST APIs.

Join us on the #opensource channel of our community Slack to give us feedback on our opensource tools.
You can create an account on Scaleway and receive a voucher of 500 EUR to use freely for one month 🚀.

Share on
Other articles about:

Recommended articles