Clone
5
Home
xenobyte edited this page 2025-12-16 12:54:56 +00:00

SUKAATO Ansible Overview

This repository is for automating the management of the configuration of, and the provisioning of software for, my virtual private servers using Ansible. It's main purpose is to spin up the VPSs, create initial users and groups, import SSH or GPG keys, lock down SSH access or harden SSH, and then install and configure packages available to the given package manager of the operating system. The bootstrap role in here serves to abstract some of these tasks for our main playbook files.

Variable Names and Their Scopes

To be able to make use of the Ansible playbooks, it is necessary to specify some variables in or at relevant scopes, though some may have some defaults. The relevant scopes variables are defined in, for our purposes, are:

  • Ansible inventory scope: corresponds to variables inside per-hostname files in group_vars or host_vars directories, or the inventory file itself, i.e. hosts.ini or hosts.yml. The inventory file has some enforced naming conventions.
  • Ansible role scope: corresponds to variables found in files inside the defaults / vars directory in a role directory, or variables found in files inside subdirectory main in either defaults or vars directory of that role directory. There are favored conventional directory structures within which these variables are specified in the aforementioned directories.

Other variables that tend to have default definitions as is but that may be of interest are those found in Jinja templates of roles, in this case of the role bootstrap. Look through the bootstrap role's templates directory and you will discover them--most of them defined in role tasks or handlers that make reference to them.

Inventory Scope

Herein are listed the relevant variables at or in the inventory scope. These must be specified for a specific inventory host or group, typically in their corresponding files under group_vars or host_vars. Some variables must take in a dictionary type with specific fields or keys to be valid.

name type value validity rule
fqdn <str> fully qualified domain name
vps_service <dict{<str>:<str|bool|list>}> valid fields providing data for spinning up new VPS
groups <dict{$group_name:<dict>}> fields/keys that are group names with data configuring that group
users <dict{$user_name:<dict>}> fields/keys that are user names with data configuring that user
keywords <list[<str>]> strings that describe the VPS, useful for applying tags if allowed by API
custom_vars <dict{<str>:<any>}> your own custom variables, though there are some reserved variable names for this namespace

For more on inventory-scoped variables, see this page.

Role Scope

Herein are listed the relevant variables at or in the role scope. These must be specified for a set of role tasks expected to run in a playbook for the host specified for its play. Some variables must take in a dictionary type with specific keys or fields to be valid.

name type value validity rule
software <dict{<str>:<dict>}> valid fields providing data for software installations
config <dict{$software_name:<dict>}> software name fields providing data for configuring that software