IT/Software/Ansible

From msgwiki
< IT‎ | Software
Revision as of 20:20, 2 May 2024 by Stefan (talk | contribs) (initial version)
Jump to navigation Jump to search

Ansible

Ansible is an open source IT automation engine that automates provisioning, configuration management, application deployment, orchestration, and many other IT processes.It is free to use, and the project benefits from the experience and intelligence of its thousands of contributors.

https://www.ansible.com/

Pros:

  • reproducible environments
  • easy to begin with
  • fast deployment
  • scalable

Cons:

  • small time investment to learn it

In a nutshell

  • A Control Node executes tasks from playbooks on Managed Nodes over SSH or API's
  • Control Node: This can be any linux based host (or wsl) where ansible is installed and is connected to the same network as the Managed Nodes
  • Managed Node: Any device that should be managed
  • playbook.yml: A yml file that contains the involved hosts, process and tasks that should be done
  • inventory.yml: A yml file that contains all hosts, grouped in sections if needed (e.g. different branches, locations, device/os types)

See also IaC/IaaC https://en.wikipedia.org/wiki/Infrastructure_as_code

Install Ansible

Linux

  • sudo apt install ansible

Windows

Execute Playbooks

  • example with a playbook named playbook-example.yml and inventory.yml
  • ansible-playbook -i inventory.yml playbook-example.yml -kK
  • -K if become/sudo is needed
  • -k for user/password based authentication