/terraform-ansible-playbook

A terraform module to execute ansible playbooks

Primary LanguageHCLMIT LicenseMIT

terraform-ansible-playbook

A terraform module to run a playbook from within terraform.

tflint tfsec yamllint misspell pre-commit-check semantic-release GitHub release (with filter)

Example

Here's what using the module will look like

module "playbook" {
  source  = "mueller-tobias/playbook/ansible"
  version = "1.0.1"
  # insert the 3 required variables here
}

About

This module can be used to execute a ansible playbook from within terraform. A change of contents of the inventory or the playbook variables will recreate the ansible resource and trigger a re-run of the playbook.

Requirements

Name Version
terraform >= 1.4

Providers

Name Version
terraform n/a

Modules

No modules.

Resources

Name Type
terraform_data.ansible_provisioning resource
terraform_data.inventory resource
terraform_data.playbook_variables resource

Inputs

Name Description Type Default Required
inventory_path Valid Ansible Inventory File string n/a yes
playbook_ansible_user User that will be connect ot the remote machine string "ansible" no
playbook_environment_vars Ansible Environment Variables map(string)
{
"ANSIBLE_HOST_KEY_CHECKING": "false"
}
no
playbook_path Path tot the Playbook that should be executed string n/a yes
playbook_ssh_key SSH Key that will be used to connect with the remote machines string "" no
playbook_variables Playbook Variables in YAML Format string n/a yes
ssh_agent_keys List of private Keys that will be added to the ssh agent before executing the playbook list(string)
[
""
]
no

Outputs

No outputs.