This is an opinionated setup for a Debian box. I currently use this to bootstrap my workstations, servers and development boxes using Ansible. It currently supports stable
and testing
.
You will need to install Ansible on the host you will be running Ansible from (aka Control Machine). Below is basic setup information. For more details about how to ensure you have a latest version of Ansible please review the Ansible Installation Guide:
- Install via pip:
pip install ansible
- Install via yum:
sudo yum install ansible
- Install via apt:
sudo apt install ansible
- Install via homebrew:
brew install ansible
Before using playbooks in this repository, you would need to create configuration files that Ansible needs to properly operate. My personal options of what each group of hosts. The files are:
hosts
– this is the Ansible inventory for all the resources to manage using this configuration. The repository has ahosts.sample
file to use an example.host_vars/<hostname>.yaml
– These are variables specific to a host like Locale and list of super users.host_vars/dev-server.example.com.yaml
is an example file.
Ansible is an agentless configuration management and orchestration tool. Most of the software packages ansible needs on the managed hosts are already baked into any basic OS setup (e.g. sudo
, python
). For best results, ensure that the following packages are installed on any node you want to manage with Ansible:
apt update
apt install sudo apt-transport-https dirmngr python python-simplejson
It is advisable to add this script to your cloud-init
or userdata
.
For this repository, we assume that you will be using SSH Public Key Authentication. Therefore, make sure your ssh-agent
already has your key loaded before running our Ansible playbooks. If you are using password-based authentication, then you will need to:
- Install
sshpass
on the Control Machine - Add the
--ask-pass
parameter to theansible-playbook
command- Optionally add
--ask-become-pass
if thesu
orsudo
password is different than the SSH password.
- Optionally add
Simply:
ansible-playbook -i hosts setup-hosts.yaml
Keep in mind if your current username is different than the remote superuser (e.g. root
), you need to add a --user
option to the command:
ansible-playbook -i hosts setup-hosts.yaml --user root