Skip to content

Commit 1eef984

Browse files
committed
allow running without venv
1 parent 3e3fccd commit 1eef984

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ This module allows creation of an Ansible Playbook component for use in EC2 Imag
9595

9696
| Name | Version |
9797
|------|---------|
98-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
98+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.14 |
9999
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.22.0 |
100100

101101
## Providers
@@ -121,6 +121,8 @@ No modules.
121121

122122
| Name | Description | Type | Default | Required |
123123
|------|-------------|------|---------|:--------:|
124+
| <a name="input_ansible_use_venv"></a> [ansible\_use\_venv](#input\_ansible\_use\_venv) | Whether or not ansible should be run in a virtual environment | `bool` | `true` | no |
125+
| <a name="input_ansible_venv_path"></a> [ansible\_venv\_path](#input\_ansible\_venv\_path) | Path at which to create the ansible virtual environment | `string` | `"/var/tmp/ansible_venv/"` | no |
124126
| <a name="input_change_description"></a> [change\_description](#input\_change\_description) | description of changes since last version | `string` | `null` | no |
125127
| <a name="input_component_version"></a> [component\_version](#input\_component\_version) | Version of the component | `string` | n/a | yes |
126128
| <a name="input_data_uri"></a> [data\_uri](#input\_data\_uri) | Use this to override the component document with one at a particualar URL endpoint | `string` | `null` | no |

component.yml.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ phases:
4545
- eval "$(ssh-agent -s)"
4646
- ssh-add ~/.ssh/git_rsa
4747
%{~ endif ~}
48+
%{ if use_venv ~}
4849
# activate venv
4950
- source ${ansible_venv_path}/bin/activate
51+
%{~ endif ~}
5052
# Install playbook dependencies
5153
- ansible-galaxy role install -f -r requirements.yml || true
5254
- ansible-galaxy collection install -f -r requirements.yml || true

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ locals {
1212
repo_host = try(local.repo_parts.host, null)
1313
repo_port = try(local.repo_parts.port, 22)
1414
ssh_key_name = try(data.aws_secretsmanager_secret.ssh_key[0].name, null)
15+
use_venv = var.ansible_use_venv
1516
})
1617

1718
repo_parts = try(

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
variable "ansible_use_venv" {
2+
default = true
3+
description = "Whether or not ansible should be run in a virtual environment"
4+
type = bool
5+
}
6+
17
variable "ansible_venv_path" {
28
default = "/var/tmp/ansible_venv/"
39
description = "Path at which to create the ansible virtual environment"

0 commit comments

Comments
 (0)