Explore

Cloud automation and infrastructure as code

by Froga

Why clicking a cloud together falls apart, and how provisioning, configuration management, cloud-init, Ansible and Terraform replace it, with state, drift and secrets. You will be able to place each tool, predict a re-run and judge a rebuild. About 15 minutes.

You're previewing this room. Log in or create a free account to answer the questions and track your progress.
Study material

What this room is about. This room is about building cloud infrastructure from code instead of from the web console. It explains why clicking does not scale, separates provisioning from configuration management, shows how cloud-init, Ansible and Terraform fit together on one server, and covers state, drift, rollback and keeping secrets out of the repository. It follows the course story from one physical server towards the cloud, now that a cloud has an API.

Why it matters. Building an environment by hand works once. At thirty machines, or when a second environment has to match the first, clicking is slow, different every time and impossible to review or repeat, and nobody can say afterwards what was done. A description kept in a repository can be reviewed, run again, rolled back and used to rebuild everything from nothing.

Words you will meet.

  • Provisioning: bringing the infrastructure itself into existence through the provider's API: networks, instances, disks and permissions, which is Terraform's job.
  • Configuration management: making a machine that already exists look a certain way, with the right packages, files and services.
  • cloud-init: a tool already installed in cloud images that reads a file attached to the instance and applies it once, at first boot.
  • Ansible: a tool that connects over SSH (Secure Shell) from a control machine and makes servers match a playbook describing the state they should be in, with no agent to install.
  • State and drift: the state is the tool's record of what it created, and drift is what happens when someone changes things by hand so reality no longer matches the code.
  • Declarative and idempotent: a declarative description states the result you want, so running it again is safe and changes nothing once that result is reached.
  • Immutable infrastructure: changing a service by building a new image and replacing the machines, instead of logging in to change them.

By the end you should be able to:

  • Explain why building by hand in a console does not scale, and why code can drive the same infrastructure.
  • Distinguish provisioning from configuration management, and place Terraform, cloud-init and Ansible in the order they act on one server.
  • Explain what plan does, what the state file holds and what to do about drift after a manual fix.
  • Compare imperative with declarative, and mutable with immutable, and predict what happens on a re-run or a rollback.
  • Judge how an automation tool should get its credentials, and whether an environment can really be rebuilt from its repository alone.

How to use it. Each question has its own study text above it, so read that first and then answer; the answers and explanations show at the end of the room.

What is provisioning?

multiple choice

AMaking a machine that already exists look right by installing packages and files
BBringing the infrastructure itself into existence: networks, instances and disks
CRecording every change made to a server so that it can be undone later
DGiving staff accounts the permission to log in to the provider's web console
Log in to answer

Ready to test yourself?

Sign up free to answer, score points, and build your streak.