Skip to content

Commit

Permalink
Add an Ansible provisioner for the bod bastion
Browse files Browse the repository at this point in the history
This ensures that all instance types are being deployed in a consistent
manner. Although nothing should really be done to the bod bastion with
our current Ansible playbook for the post-deployment provisioner; this
will ensure any future changes for all hosts apply.
  • Loading branch information
mcdonnnj committed Oct 17, 2023
1 parent b7e7bec commit a6ed77d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ terraform apply -var-file=<your_workspace>.tfvars

| Name | Source | Version |
|------|--------|---------|
| bod\_bastion\_ansible\_provisioner | github.com/cloudposse/terraform-null-ansible | n/a |
| bod\_docker\_ansible\_provisioner | github.com/cloudposse/terraform-null-ansible | n/a |
| cyhy\_bastion\_ansible\_provisioner | github.com/cloudposse/terraform-null-ansible | n/a |
| cyhy\_dashboard\_ansible\_provisioner | github.com/cloudposse/terraform-null-ansible | n/a |
Expand Down
16 changes: 16 additions & 0 deletions terraform/bod_bastion_ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,19 @@ resource "aws_instance" "bod_bastion" {
},
)
}

# Provision the bastion EC2 instance via Ansible
module "bod_bastion_ansible_provisioner" {
source = "github.com/cloudposse/terraform-null-ansible"

arguments = [
"--user=${var.remote_ssh_user}",
"--ssh-common-args='-o StrictHostKeyChecking=no'",
]
envs = [
"host=${aws_instance.bod_bastion.public_ip}",
"host_groups=bod_bastion",
]
playbook = "../ansible/playbook.yml"
dry_run = false
}

0 comments on commit a6ed77d

Please sign in to comment.