Skip to content

alghanmi/my-debian-box

Repository files navigation

My Debian Box

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.

Prerequisites

Setup Ansible

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

Ansible Playbook Configuration

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 a hosts.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.

Managed Nodes Setup

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.

Remote User Setup

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 the ansible-playbook command
    • Optionally add --ask-become-pass if the su or sudo password is different than the SSH password.

Running Playbooks

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

About

An opinionated setup of Debian hosts using Ansible

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages