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 files to be decrypted before runningList 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

current_ansible_toolchain

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

current_ansible_toolchain(name, lib)

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
libWhich py_library within the ansible toolchain to yield providers fromStringoptional"ansible"

ansible_lint_aspect

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

ansible_lint_aspect()

An aspect for linting ansible targets.

ASPECT ATTRIBUTES

ATTRIBUTES