Description:

  • Configuration management

  • Agentless: dont have to install anything on the target system, use SSH

    • except Python
  • Use cases:

    • Eliminate repetition and simplify workflows
    • Manage and maintain system configuration
    • Continuously deploy complex software
    • Perform zero-downtime rolling updates
  • 1 control node and many managemed nodes

    • managed node: run the instruction sent from control
  • Ansible Inventory:

    • contain informatin about the managed nodes
      • in .init or .yaml
    • nodes can be grouped into groups, groups can be grouped into meta group
    • host variables ar defined as key-value pairs
  • Idempotency:

    • Idempotency means one action executing once or many times yield the same result
    • Most ansible modules are idempotent
    • Module idempotency is the key component for Ansible to implement the declarative approach of IaC

Google Namespace in Ansible

Getting started:

Basic:
Installation:
  • pip install ansible
Concepts:

Installation:

Using Ansible:

Building Inventories
s

Commands:

  • ansible - Define and run a single task ‘playbook’ against a set of hosts.
  • ansible-config - View ansible configuration.
  • ansible-console - REPL console for executing Ansible tasks.
  • ansible-doc - Plugin documentation tool.
  • ansible-galaxy - Collection and role operations
  • ansible-inventory - Show inventory informations
  • ansible-playbook - Runs Ansible playbooks, executing the defined tasks on the targeted hosts.
  • ansible-pull - Pulls playbooks from a VCS repo and executes them for the local host
  • ansible-vault - Encryption/decryption utility for Ansible data files