# Ansible

# bootstrap

Useful script to quickly setup a new ansible project. I called it ansible-bootrap.

Download and setup can be found on gitlab here. (opens new window)

Usage:

mkdir new-project && cd new-project
ansible-bootrap -l
tree
.
├── ansible.cfg
├── group_vars
│   └── all.yml
├── inventory.hosts
├── main.yml
├── roles
└── templates

# Config file

A minimalistic usage of the Ansible configuration file. Full list of parameters can be found on the official example ansible.cfg (opens new window)

[defaults]
host_key_checking = False
inventory=./inventory.hosts
retry_files_enabled = False
nocolor = 0
force_color = 1
stdout_callback = debug

# inventory

Basic inventory usage

[dev]
192.168.1.100

[prod]
192.168.1.100

[active:children]
dev
prod

[active:vars]
ansible_user=ubuntu
ansible_ssh_private_key_file=~/.ssh/secret.pem

# ping

Testing a connection to verify inventory configuration and access to the server. This is not an ICMP ping but rather a successful ssh connection and remote execution.

ansible dev -m ping