rules_ansible

Overview

Bazel rules for Ansible

Setup

bazel_dep(name = "rules_ansible", version = "{version}")

rules_ansible

Rules

Aspects

ansible_lint_test

load("@rules_ansible//ansible:defs.bzl", "ansible_lint_test")

ansible_lint_test(name, config, playbook)

A test rule for running ansible-lint on an Ansible playbook.

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
configThe ansible-lint config file to useLabeloptional"@rules_ansible//ansible:lint_config"
playbookThe ansible_playbook target to lint.Labelrequired

ansible_playbook

load("@rules_ansible//ansible:defs.bzl", "ansible_playbook")

ansible_playbook(name, config, hosts, inventory, playbook, roles, vault)

A rule for running Ansible playbooks

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
configThe path to an Ansible config file.Labeloptional"@rules_ansible//ansible:config"
hostsAnsible hosts fileLabelrequired
inventoryAnsible inventory filesList of labelsoptional[]
playbookThe ansible playbook yaml file.Labelrequired
rolesThe source files for all ansible roles required by the playbook.List of labelsoptional[]
vaultVault encrypted files required by the playbook. These are never decrypted on disk. Ansible decrypts them in memory at runtime using the vault password file located by the launcher (a .vault_pass file next to the playbook, its parent package, or the workspace root) or one passed explicitly via --vault-password-file.List of labelsoptional[]

ansible_toolchain

load("@rules_ansible//ansible:defs.bzl", "ansible_toolchain")

ansible_toolchain(name, ansible, ansible_core, ansible_lint)

An ansible toolchain

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
ansibleAn ansible py_library target.Labelrequired
ansible_coreAn ansible-core py_library target.Labelrequired
ansible_lintAn ansible-lint py_library target.Labelrequired

ansible_lint_aspect

load("@rules_ansible//ansible:defs.bzl", "ansible_lint_aspect")

ansible_lint_aspect()

An aspect for linting ansible targets.

ASPECT ATTRIBUTES

ATTRIBUTES