Automation & Programmability // Lesson 06

Ansible & Terraform.

Recognise how Ansible and Terraform express and apply desired infrastructure state through repeatable automation.

AnsibleTerraformPlaybookStateDeclarative
01 // Mental model

Start with the big picture.

Runs ordered tasks from playbooks against an inventory, commonly using modules and usually agentless connectivity.

CCNA focus: Know capabilities, not product trivia. Both support automation, but their models, state handling and common workflows differ. Protect credentials and review generated changes.
02 // Building blocks

Know what each part does.

01

Ansible

Runs ordered tasks from playbooks against an inventory, commonly using modules and usually agentless connectivity.

02

Terraform

Uses declarative configuration, providers and state to plan and apply infrastructure resource changes.

03

Desired state

The code describes what should exist; the tool works out actions needed to converge.

04

Reviewable change

Versioned files and plan/diff output make intended modifications visible before execution.

03 // Compare and recognise

Read the clues.

ItemWhat to remember
InventoryAnsible's hosts and groups plus variables.
PlaybookYAML document describing plays and tasks.
ProviderTerraform plugin that manages a platform's API resources.
StateTerraform's mapping between configuration and managed real-world objects; protect it carefully.
04 // Mechanism comparison

Mechanism comparison.

Ansible:
  inventory -> playbook -> modules -> devices/services
  useful for configuration workflows and orchestration

Terraform:
  configuration -> plan -> reviewed changes -> apply
  provider APIs -> managed infrastructure resources
  state tracks resource relationships

Read the example from top to bottom, then verify the resulting state. Configuration is only complete when the output matches the intended design.

05 // Exam and troubleshooting

Turn facts into a method.

  • Ansible's hosts and groups plus variables.
  • YAML document describing plays and tasks.
  • Terraform plugin that manages a platform's API resources.
  • Terraform's mapping between configuration and managed real-world objects; protect it carefully.
Exam checkpoint: Know capabilities, not product trivia. Both support automation, but their models, state handling and common workflows differ. Protect credentials and review generated changes.
06 // Check yourself

Ansible & Terraform quiz.

1. What file commonly defines Ansible tasks?

2. What does an Ansible inventory describe?

3. What does Terraform plan show?

4. Why is Terraform state sensitive?

5. What connects Terraform to a platform API?

Score: 0 / 5