Skip to content

Commit

Permalink
allow running without venv
Browse files Browse the repository at this point in the history
  • Loading branch information
dgoodellrhy committed Apr 22, 2024
1 parent 3e3fccd commit 1eef984
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ This module allows creation of an Ansible Playbook component for use in EC2 Imag

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

## Providers
Expand All @@ -121,6 +121,8 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <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 |
| <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 |
| <a name="input_change_description"></a> [change\_description](#input\_change\_description) | description of changes since last version | `string` | `null` | no |
| <a name="input_component_version"></a> [component\_version](#input\_component\_version) | Version of the component | `string` | n/a | yes |
| <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 |
Expand Down
2 changes: 2 additions & 0 deletions component.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ phases:
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/git_rsa
%{~ endif ~}
%{ if use_venv ~}
# activate venv
- source ${ansible_venv_path}/bin/activate
%{~ endif ~}
# Install playbook dependencies
- ansible-galaxy role install -f -r requirements.yml || true
- ansible-galaxy collection install -f -r requirements.yml || true
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ locals {
repo_host = try(local.repo_parts.host, null)
repo_port = try(local.repo_parts.port, 22)
ssh_key_name = try(data.aws_secretsmanager_secret.ssh_key[0].name, null)
use_venv = var.ansible_use_venv
})

repo_parts = try(
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
variable "ansible_use_venv" {
default = true
description = "Whether or not ansible should be run in a virtual environment"
type = bool
}

variable "ansible_venv_path" {
default = "/var/tmp/ansible_venv/"
description = "Path at which to create the ansible virtual environment"
Expand Down

0 comments on commit 1eef984

Please sign in to comment.