Components¶
The thirteen built-in components of the kikx registry, generated from GET /api/registry. Components and fields are also printed by kikx list.
Every field value is a string. Every template also receives name, namespace and labels, described in Registry item format. Output paths are relative to the target directory and are rendered with the same context as the file content.
A reference resolves to a built-in when the part after its last / equals a built-in name. See Registry item format.
Summary¶
Reference |
Title |
Description |
Output paths |
|---|---|---|---|
Deployment |
Pods running one container image. |
|
|
Service |
A stable address for pods. |
|
|
Ingress |
Routes HTTP traffic to a service. |
|
|
DigitalOcean Droplet |
Terraform for one or more DigitalOcean droplets. |
|
|
Hetzner Cloud Server |
Terraform for one or more Hetzner Cloud servers. |
|
|
Kubernetes Bootstrap |
Installs containerd, kubelet, kubeadm and kubectl on target hosts. |
|
|
Inventory |
Hosts, groups, nesting and shared vars for servers you already have. |
|
|
Group vars |
Variables for one inventory group. |
|
|
Common role |
A starter host-hygiene role: base packages, timezone, swap, a templated motd. |
|
|
Role skeleton |
An empty role (tasks, defaults, handlers, meta) to fill in. |
|
|
Playbook |
One or more plays, each running roles on an inventory group. |
|
|
Site playbook |
The entry point that imports your playbooks in order. |
|
|
Ansible config |
ansible.cfg pointing Ansible at your inventory and roles, so playbooks in subfolders find them. |
|
k8s/deployment¶
Property |
Value |
|---|---|
Title |
Deployment |
Description |
Pods running one container image. |
Output paths |
|
Template fallbacks |
|
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
yes |
— |
|
— |
— |
|
no |
|
— |
— |
— |
|
no |
|
— |
— |
— |
k8s/service¶
Property |
Value |
|---|---|
Title |
Service |
Description |
A stable address for pods. |
Output paths |
|
Template fallbacks |
|
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
no |
|
— |
— |
— |
|
no |
— |
— |
— |
Container port; defaults to the service port. |
k8s/ingress¶
Property |
Value |
|---|---|
Title |
Ingress |
Description |
Routes HTTP traffic to a service. |
Output paths |
|
Template fallbacks |
|
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
no |
— |
|
— |
— |
|
no |
|
— |
— |
— |
|
no |
— |
— |
— |
Backend service; defaults to the ingress name. |
|
no |
|
— |
— |
— |
terraform/digitalocean¶
Property |
Value |
|---|---|
Title |
DigitalOcean Droplet |
Description |
Terraform for one or more DigitalOcean droplets. |
Output paths |
|
Template fallbacks |
Declares variable |
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
yes |
— |
|
— |
— |
|
yes |
— |
|
— |
— |
|
yes |
|
— |
|
Any image slug the provider accepts; the list is a shortcut. |
|
no |
|
— |
— |
— |
terraform/hetzner¶
Property |
Value |
|---|---|
Title |
Hetzner Cloud Server |
Description |
Terraform for one or more Hetzner Cloud servers. |
Output paths |
|
Template fallbacks |
Declares variable |
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
yes |
— |
|
— |
— |
|
yes |
— |
|
— |
— |
|
yes |
|
— |
|
Any image slug the provider accepts; the list is a shortcut. |
|
no |
|
— |
— |
— |
ansible/k8s-bootstrap¶
Property |
Value |
|---|---|
Title |
Kubernetes Bootstrap |
Description |
Installs containerd, kubelet, kubeadm and kubectl on target hosts. |
Output paths |
|
Template fallbacks |
Installs |
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
yes |
— |
— |
— |
An inventory group, or all. |
|
yes |
— |
|
— |
— |
ansible/inventory¶
Property |
Value |
|---|---|
Title |
Inventory |
Description |
Hosts, groups, nesting and shared vars for servers you already have. |
Output paths |
|
JSON-valued fields |
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
yes |
— |
— |
— |
— |
|
no |
|
— |
— |
SSH user written for hosts that don’t set one (null on a host omits it). |
|
no |
|
— |
— |
SSH port written for hosts that don’t set one (null on a host omits it). |
ansible/group-vars¶
Property |
Value |
|---|---|
Title |
Group vars |
Description |
Variables for one inventory group. |
Output paths |
|
Template fallbacks |
|
JSON-valued fields |
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
yes |
— |
— |
— |
— |
|
no |
— |
— |
— |
JSON map of simple key/value pairs. |
|
no |
— |
— |
— |
Raw YAML body, written as-is. |
|
no |
|
— |
|
— |
ansible/common-role¶
Property |
Value |
|---|---|
Title |
Common role |
Description |
A starter host-hygiene role: base packages, timezone, swap, a templated motd. |
Output paths |
|
Template fallbacks |
|
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
no |
|
— |
— |
— |
ansible/role¶
Property |
Value |
|---|---|
Title |
Role skeleton |
Description |
An empty role (tasks, defaults, handlers, meta) to fill in. |
Output paths |
|
Template fallbacks |
|
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
no |
|
— |
— |
— |
ansible/playbook¶
Property |
Value |
|---|---|
Title |
Playbook |
Description |
One or more plays, each running roles on an inventory group. |
Output paths |
|
Template fallbacks |
|
JSON-valued fields |
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
no |
— |
— |
— |
— |
|
no |
— |
— |
— |
— |
|
no |
— |
— |
— |
JSON list of plays: name, hosts, become, tags, roles, pre_tasks, post_tasks. |
|
no |
— |
|
— |
Where the file goes. Leave empty for the project root. |
ansible/site¶
Property |
Value |
|---|---|
Title |
Site playbook |
Description |
The entry point that imports your playbooks in order. |
Output paths |
|
JSON-valued fields |
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
yes |
— |
— |
— |
— |
ansible/config¶
Property |
Value |
|---|---|
Title |
Ansible config |
Description |
ansible.cfg pointing Ansible at your inventory and roles, so playbooks in subfolders find them. |
Output paths |
|
Template fallbacks |
|
Field |
Required |
Default |
Example |
Options |
Description |
|---|---|---|---|---|---|
|
no |
— |
|
— |
— |
|
no |
|
— |
— |
— |
Example: inventory=platform-inventory.ini writes ansible.cfg:
[defaults]
inventory = platform-inventory.ini
roles_path = roles
Ansible reads ansible.cfg from the directory it is run in. From the output directory, ansible-playbook site.yml then uses that inventory without -i, and finds roles in roles/ even for playbooks in a subfolder such as playbooks/.
JSON field shapes¶
A field value whose first non-whitespace character is [ or { and that parses as JSON is passed to the template as a list or map. Any other value, including invalid JSON, is passed as a string. Object keys are iterated in alphabetical order.
hosts¶
Field of ansible/inventory. A JSON array of group objects, written in array order.
Key |
Type |
Written as |
|---|---|---|
|
string |
Section name |
|
array of host objects |
|
|
array of strings |
|
|
object |
|
Host object:
Key |
Type |
Written as |
|---|---|---|
|
string |
First token of the host line |
|
string |
|
|
string or |
|
|
number, string or |
|
|
string |
|
|
object |
|
A host listed under several groups is written in each of those groups.
Missing, null and empty¶
|
Written |
|---|---|
key missing |
|
|
nothing |
non-empty value |
|
ansible_port follows the same rules with default_port.
Example value:
[
{"group": "web", "members": [
{"name": "web-01", "ansible_host": "192.0.2.10"},
{"name": "web-02", "ansible_host": "192.0.2.11", "ansible_user": null, "ansible_port": null},
{"name": "web-03", "ansible_host": "192.0.2.12", "ansible_user": "deploy", "ansible_port": 2222,
"ssh_key_file": "~/.ssh/id_ed25519", "vars": {"http_port": 8080}}
], "vars": {"ntp": "pool.ntp.org"}},
{"group": "db", "members": [{"name": "db-01", "ansible_host": "198.51.100.5", "ansible_user": ""}]},
{"group": "platform", "children": ["web", "db"], "vars": {"env": "prod"}}
]
Output with the default default_user and default_port:
[web]
web-01 ansible_host=192.0.2.10 ansible_user=root ansible_port=22
web-02 ansible_host=192.0.2.11
web-03 ansible_host=192.0.2.12 ansible_user=deploy ansible_port=2222 ansible_ssh_private_key_file=~/.ssh/id_ed25519 http_port=8080
[web:vars]
ntp=pool.ntp.org
[db]
db-01 ansible_host=198.51.100.5 ansible_port=22
[platform:children]
web
db
[platform:vars]
env=prod
vars, yaml and layout¶
Fields of ansible/group-vars.
Field |
Shape |
Written as |
|---|---|---|
|
JSON object |
One |
|
string |
Written after |
|
|
|
The path uses the group field, not the component name.
Example: group=db, vars={"pg_version":16,"pg_port":5432} writes group_vars/db.yml:
---
pg_port: 5432
pg_version: 16
plays¶
Field of ansible/playbook. A JSON array of play objects, written in order and separated by a blank line.
Key |
Type |
Default |
Written as |
|---|---|---|---|
|
string |
component name |
|
|
string |
— |
|
|
boolean |
|
|
|
array of strings |
— |
|
|
string of YAML tasks |
— |
|
|
array of role entries |
— |
|
|
string of YAML tasks |
— |
|
Role entry:
Form |
Written as |
|---|---|
|
|
|
|
|
|
Example value, with component name data and folder=playbooks:
[
{"name": "Data tier", "hosts": "db", "become": false, "tags": ["data", "db"],
"roles": ["common", {"role": "postgres", "when": "inventory_hostname == groups[\"db\"][0]"}],
"pre_tasks": "- name: Wait\n ansible.builtin.wait_for_connection:\n",
"post_tasks": "- name: Done\n ansible.builtin.debug:\n msg: ok\n"},
{"hosts": "web", "roles": ["nginx"]}
]
Output, playbooks/data.yml:
---
- name: Data tier
hosts: db
tags: [data, db]
pre_tasks:
- name: Wait
ansible.builtin.wait_for_connection:
roles:
- common
- role: postgres
when: inventory_hostname == groups["db"][0]
post_tasks:
- name: Done
ansible.builtin.debug:
msg: ok
- name: data
hosts: web
become: true
roles:
- nginx
Legacy hosts and roles¶
Fields of ansible/playbook, used when plays is missing or empty. They produce one play named after the component, with become: true.
Field |
Shape |
|---|---|
|
string |
|
JSON array of role names |
Example: component name legacy, hosts=web, roles=["common","nginx"] writes legacy.yml:
---
- name: legacy
hosts: web
become: true
roles:
- common
- nginx
plays covers everything this form does, plus names, tags, role conditions and several plays per file. Prefer it for new playbooks.
playbooks¶
Field of ansible/site. A JSON array of objects, written in order.
Key |
Type |
Written as |
|---|---|---|
|
string |
|
|
string |
|
Example: [{"name":"Data","path":"playbooks/data.yml"},{"name":"Legacy","path":"legacy.yml"}] writes:
---
- name: Data
import_playbook: playbooks/data.yml
- name: Legacy
import_playbook: legacy.yml