first commit
This commit is contained in:
commit
be982083f4
21
README.md
Normal file
21
README.md
Normal 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
6
ansible.cfg
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Ansible config file
|
||||||
|
|
||||||
|
|
||||||
|
[defaults]
|
||||||
|
any_fatal_errors=True
|
||||||
|
inventory = ./inventory
|
5
inventory/group_vars/all/vars.yml
Normal file
5
inventory/group_vars/all/vars.yml
Normal 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
|
0
inventory/host_vars/mail.server.com
Normal file
0
inventory/host_vars/mail.server.com
Normal file
2
inventory/host_vars/web.server.com.yml
Normal file
2
inventory/host_vars/web.server.com.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
---
|
||||||
|
ansible_host: 136.244.87.93
|
2
inventory/inventory.yml
Normal file
2
inventory/inventory.yml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
web.server.com
|
||||||
|
mail.server.com
|
8
playbook.yml
Normal file
8
playbook.yml
Normal 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
|
Loading…
Reference in New Issue
Block a user