abn.managed-node-bootstrap
Managed Node Bootstrap
This tool helps you set up an Ansible-managed server with very few extra requirements. It was initially created for setting up servers using Docker images, so it may need some updates before it's fully reliable for other uses.
Supported Operating Systems:
- Alpine Linux
- Debian-based systems (like Ubuntu)
- OpenSUSE
- Red Hat-based systems (like Red Hat Enterprise Linux, CentOS, Fedora)
Requirements
You only need an Ansible version that has the raw
module. Development was done using Ansible 2.2 or later.
Role Variables
You can customize the setup using these variables:
managed_node_bootstrap_use_sudo
: Set this toyes
if you're connecting as a user who can usesudo
.managed_node_bootstrap_cmd_prefix
: By default, this is set tosudo
if the previous variable is set toyes
. You can change it if needed.managed_node_bootstrap_done_file
: This tells the script which file to check to see if the setup has been completed before.managed_node_packages_{alpine,debian,opensuse,redhat}
: Use this to specify which packages you want to install for each type of system.
Dependencies
No extra dependencies are needed apart from Ansible.
Example Playbook
Here's an example of how to use it to set up all your servers listed in your inventory. Make sure to set up the Ansible connection method beforehand. Also, it assumes you'll connect as a root user, as we expect sudo
may not be available on certain Docker images. You can change this behavior if needed.
---
- name: bootstrap ansible managed node
hosts: all
gather_facts: False
roles:
- abn.molecule-node-bootstrap
Testing
Before you test, make sure to clone the required submodules:
git submodule update --init --recursive
Local Environment
This tool uses Molecule and Docker for testing. You can run it locally if you have Python and Docker installed.
# Install required packages for testing
pip install -r test-requirements.txt
molecule test
This will start containers of the supported operating systems and run a sample playbook.
Tox
The project also uses tox to test against different versions of Ansible. You can run it easily with:
tox
Look at the Molecule documentation and tox documentation for more advanced instructions.
License
This tool is licensed under the Apache License 2.0.
Bootstrap an ansible managed node with minimal dependencies
ansible-galaxy install abn.managed-node-bootstrap