Viewing the current state
-
Registering variables – Infrastructure as Code (IaC) with Terraform-3
The common directory contains a single directory called tasks that includes a main.yaml file with a single task to run an apt update operation. The main directory contains ansible.cfg, hosts,…
-
Registering variables – Infrastructure as Code (IaC) with Terraform-2
Tip While choosing between the vars and defaults directories, the rule of thumb is to put variables that will not change within the vars directory. Put variables that are likely…
-
Registering variables – Infrastructure as Code (IaC) with Terraform
If a task within your playbook, for example, needs a value from the result of a preceding task, we can use the register attribute. The following directory contains all the…
-
Dictionary variables – Infrastructure as Code (IaC) with Terraform
Dictionary variables hold a complex combination of key-value pairs, the same as a Python dictionary. You can define dictionary variables using the standard YAML syntax, as in the following example:foo:bar:…
-
Designing for reusability – Infrastructure as Code (IaC) with Terraform
Ansible provides variables for turning Ansible playbooks into reusable templates. You can substitute variables in the right places using Jinja2 markup, which we’ve already used in the last playbook. Let’s…
-
Ansible tasks and modules – Infrastructure as Code (IaC) with Terraform
Ansible tasks form the basic building block of running Ansible commands. Ansible tasks are structured in the following format: $ ansible <options> <inventory> Ansible modules are reusable code for a…
-
Setting up the Ansible configuration file – Infrastructure as Code (IaC) with Terraform
The Ansible configuration file defines global properties that are specific to our setup. The following are ways in which you can specify the Ansible configuration file, and the first method…
-
Installing Ansible in the control node – Infrastructure as Code (IaC) with Terraform
Ansible requires a Linux/Unix machine (preferably), and you should have Python 2.x or 3.x installed. As the Ansible control node runs on Ubuntu, Ansible provides a personal package archive (PPA)…
-
Connecting the Ansible control node with inventory servers – Infrastructure as Code (IaC) with Terraform
We’ve already set up passwordless SSH between the control node and managed nodes when we provisioned the infrastructure using Terraform. Let’s look at how we did that to understand it…
-
Setting up Ansible – Infrastructure as Code (IaC) with Terraform
We need to set up and install Ansible in the control node, but before we do that, we will have to spin three servers to start the activity—an Ansible control…