29 lines
575 B
HCL
29 lines
575 B
HCL
terraform {
|
|
required_providers {
|
|
ansible = {
|
|
version = "~> 1.3.0"
|
|
source = "ansible/ansible"
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "ansible_host" "host" {
|
|
name = var.ansible_hostname
|
|
groups = ["thegroup"]
|
|
}
|
|
|
|
resource "ansible_group" "group" {
|
|
name = "thegroup"
|
|
children = [var.ansible_hostname]
|
|
variables = {
|
|
ansible_ssh_user = var.ansible_ssh_user
|
|
ansible_ssh_private_key_file = var.ansible_key_file
|
|
}
|
|
}
|
|
|
|
resource "ansible_playbook" "playbook" {
|
|
playbook = var.ansible_playbook_path
|
|
name = var.ansible_hostname
|
|
replayable = true
|
|
}
|