Skip to content

Commit a27a67d

Browse files
authored
Merge pull request #5 from rhythmictech/additional_pkgs
Add support for including arbitrary yum packages when installing ansible
2 parents a4fd449 + ba9d784 commit a27a67d

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ This module bridges the gap allowing Terraform to create an EC2 Image Builder co
101101
|------|-------------|------|---------|:--------:|
102102
| component\_version | Version of the component | `string` | n/a | yes |
103103
| name | name to use for component | `string` | n/a | yes |
104+
| additional\_packages | Space separated list of additional packages that may be needed for your ansible workflow | `string` | `""` | no |
104105
| change\_description | description of changes since last version | `string` | `null` | no |
105106
| cloudformation\_timeout | How long to wait (in minutes) for CFN to apply before giving up | `number` | `10` | no |
106107
| data\_uri | Use this to override the component document with one at a particualar URL endpoint | `string` | `null` | no |

component.yml.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ phases:
1111
inputs:
1212
commands:
1313
# Install Ansible dependencies
14-
- sudo yum install -y python python3 python-pip python3-pip git
14+
- sudo yum install -y python python3 python-pip python3-pip git ${additional_pkgs}
1515
# Enable Ansible repository
1616
- sudo amazon-linux-extras enable ansible2
1717
# Install Ansible

main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ locals {
22
has_ssh_key = var.ssh_key_secret_arn != null || var.ssh_key_secret_name != null
33

44
data = templatefile("${path.module}/component.yml.tpl", {
5-
description = var.description
6-
name = var.name
7-
ssh_key_name = try(data.aws_secretsmanager_secret.ssh_key[0].name, null)
5+
additional_pkgs = var.additional_packages
6+
description = var.description
7+
name = var.name
8+
ssh_key_name = try(data.aws_secretsmanager_secret.ssh_key[0].name, null)
89
})
910
}
1011

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
variable "additional_packages" {
2+
default = ""
3+
description = "Space separated list of additional packages that may be needed for your ansible workflow"
4+
type = string
5+
}
6+
17
variable "change_description" {
28
default = null
39
description = "description of changes since last version"

0 commit comments

Comments
 (0)