Skip to content

Options

ansiblePackage

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.

Type:

package

Default value:

<derivation python3.13-ansible-core-2.18.6>

Example value:

pkgs.ansible

Declared in:

collections

Ansible collections to fetch and install from Galaxy.

Type:

attribute set of (submodule)

Default value:

{ }

Example value:

{
  community-general = {
    hash = "sha256-...";
    version = "8.0.0";
  };
}

Declared in:

collections.<name>.hash

SHA256 hash of the collection tarball for verification.

Type:

string

Example value:

"sha256-..."

Declared in:

collections.<name>.version

Version of the collection.

Type:

string

Example value:

"1.0.0"

Declared in:

dependencies

List of packages to include at runtime

Type:

list of package

Default value:

[ ]

Example value:

[pkgs.git pkgs.rsync]

Declared in:

inventory

Ansible inventory, will be converted to JSON and passed to Ansible.

Type:

attribute set

Default value:

{ }

Example value:

{
  webservers = {
    hosts = {
      web1 = {
        ansible_host = "192.168.1.10";
      };
    };
    vars = {
      http_port = 80;
    };
  };
}

Declared in:

playbook

The actual playbook, defined as a Nix data structure

Type:

list of (attribute set of attribute set of anything)

Example value:

[
  {
    become = true;
    hosts = "webservers";
    name = "Configure servers";
    tasks = [
      {
        name = "Install nginx";
        package = {
          name = "nginx";
          state = "present";
        };
      }
    ];
  }
]

Declared in:

playbook.*.become

Whether to use privilege escalation (become: yes).

Type:

boolean

Default value:

unset

Declared in:

playbook.*.become_method

Privilege escalation method.

Type:

string

Default value:

unset

Declared in:

playbook.*.gather_facts

Whether to run the setup module to gather facts before executing tasks.

Type:

boolean or string

Default value:

unset

Declared in:

playbook.*.hosts

The target hosts for this play (e.g., 'all', 'webservers').

Type:

string

Example value:

"all"

Declared in:

playbook.*.name

Name of the play.

Type:

string

Declared in:

playbook.*.remote_user

The user to execute tasks as on the remote server.

Type:

string

Default value:

unset

Declared in:

playbook.*.tags

Tags to filter tasks to run.

Type:

list of string

Default value:

unset

Declared in:

playbook.*.tasks

List of tasks to execute in this play

Type:

list of (attribute set of attribute set of anything)

Default value:

[ ]

Declared in:

playbook.*.tasks.*.always

Tasks that always run, regardless of task status.

Type:

list of (attribute set)

Default value:

unset

Declared in:

playbook.*.tasks.*.block

A block of tasks to execute.

Type:

list of (attribute set of attribute set of anything)

Default value:

unset

Declared in:

playbook.*.tasks.*.delegate_to

Delegate task execution to another host.

Type:

string

Default value:

unset

Declared in:

playbook.*.tasks.*.ignore_errors

Ignore errors and continue with the playbook.

Type:

boolean

Default value:

unset

Declared in:

playbook.*.tasks.*.loop

Define a loop for the task.

Type:

anything

Default value:

unset

Declared in:

playbook.*.tasks.*.name

Name of the task.

Type:

string

Default value:

unset

Declared in:

playbook.*.tasks.*.register

Register the task's output to a variable.

Type:

string

Default value:

unset

Declared in:

playbook.*.tasks.*.rescue

A list of tasks to execute on failure of block tasks.

Type:

list of (attribute set of attribute set of anything)

Default value:

unset

Declared in:

playbook.*.tasks.*.when

Condition under which the task runs.

Type:

string

Default value:

unset

Declared in:

playbook.*.vars

Variables for the play.

Type:

attribute set

Default value:

unset

Declared in:

playbook.*.when

Condition under which the play runs.

Type:

string

Default value:

unset

Declared in: