feat: add more options and generate docs for all options

This commit is contained in:
technofab 2025-08-09 20:49:11 +02:00
parent ba08a453ea
commit 8dccb9a9a8
No known key found for this signature in database
5 changed files with 213 additions and 166 deletions

3
docs/options.md Normal file
View file

@ -0,0 +1,3 @@
# Options
{% include 'options.md' %}

View file

@ -84,132 +84,6 @@ mkNixibleCli config
Creates a CLI executable for your Nixible configuration.
Basically `(mkNixible config).config.cli`.
## Configuration Options
______________________________________________________________________
### `ansiblePackage`
**Type:** `package`
**Default:** Custom ansible-core package
The Ansible package to use. The default package is optimized for size, by not
including the gazillion collections that `pkgs.ansible` and `pkgs.ansible-core` include.
```nix
ansiblePackage = pkgs.ansible;
```
### `collections`
**Type:** `attrsOf collectionType`
**Default:** `{}`
Ansible collections to fetch from Galaxy.
```nix
collections = {
"community-general" = {
version = "8.0.0";
hash = "sha256-...";
};
};
```
### `dependencies`
**Type:** `listOf package`
**Default:** `[]`
Additional packages available at runtime.
```nix
dependencies = [pkgs.git pkgs.rsync];
```
### `inventory`
**Type:** `attrs`
**Default:** `{}`
Ansible inventory as Nix data structure, converted to JSON.
```nix
inventory = {
webservers = {
hosts = {
web1 = { ansible_host = "192.168.1.10"; };
};
vars = {
http_port = 80;
};
};
};
```
### `playbook`
**Type:** `listOf playbookType`
List of plays that make up the playbook.
```nix
playbook = [
{
name = "Configure servers";
hosts = "webservers";
become = true;
tasks = [
{
name = "Install nginx";
package = {
name = "nginx";
state = "present";
};
}
];
}
];
```
## Collection Type
### `version`
**Type:** `str`
Version of the collection from Ansible Galaxy.
### `hash`
**Type:** `str`
SHA256 hash of the collection tarball for verification.
## Playbook Type
### `name`
**Type:** `str`
Name of the play.
### `hosts`
**Type:** `str`
Target hosts pattern (e.g., "all", "webservers", "localhost").
### `become`
**Type:** `bool`
**Default:** `false`
Whether to use privilege escalation.
### `tasks`
**Type:** `listOf attrs`
**Default:** `[]`
List of tasks to execute. Each task corresponds to Ansible task syntax.
Standard Ansible playbook options are supported: `gather_facts`, `serial`, `vars`, `vars_files`, `tags`, `handlers`, `pre_tasks`, `post_tasks`, etc.
See [options](./options.md) for more.