first commit

This commit is contained in:
Dimitrije Dimitrijevic 2023-08-22 15:48:17 +02:00
commit be982083f4
7 changed files with 44 additions and 0 deletions

21
README.md Normal file
View File

@ -0,0 +1,21 @@
# Taking small steps to learn Ansible; I will write as a notes to myself.
## What is Ansible ?
Ansible is automation tool for making infrastructure as code.
Helps with managing multiple servers/machines from one code base, making sure all the servers where the ansible is executed have the same configuration.
Ansible is agentless, does not need installing ansible on target machine, only python interpreter.
### Nodes
- Control Node (From which is ansible executed to managed nodes)
- Managed Node (Server/Machine which we are managing such as remote hosts, PC-s, servers, embedded devices)
## Ansible Repo (dir)
Consists of several parts:
- Inventory (Holds hosts to manage)
- Playbooks (What should be executed on the target host)
- Modules
- Ansible Configuration
### Playbooks
- Set of plays which are executed on target machine.
- Each play has a set of tasks
- Multiple repetetive tasks can be group inside **ROLES**
- **ROLES** (Tasks, Handlers, Vars, Plugins, Templates, Files)

6
ansible.cfg Normal file
View File

@ -0,0 +1,6 @@
# Ansible config file
[defaults]
any_fatal_errors=True
inventory = ./inventory

View File

@ -0,0 +1,5 @@
# This will load variables for ansible group all
# which is by ansible default all the hosts in inventory file
# This something like global variables which are accessible by all host
---
ansible_user: root

View File

View File

@ -0,0 +1,2 @@
---
ansible_host: 136.244.87.93

2
inventory/inventory.yml Normal file
View File

@ -0,0 +1,2 @@
web.server.com
mail.server.com

8
playbook.yml Normal file
View File

@ -0,0 +1,8 @@
- name: Name of play -> my first play
hosts: freebsd_machines
tasks:
- name: Ping my host
ansible.builtin.ping:
- name: Print message
ansible.builtin.debug:
msg: Hello world from freebsd