Skip to content

Commit 3c3e2b9

Browse files
authored
Merge pull request #21 from rhythmictech/ENG-3526
move ansible to python 3 venv
2 parents 3a0c386 + e4ab0d1 commit 3c3e2b9

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

component.yml.tpl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ phases:
4545
- eval "$(ssh-agent -s)"
4646
- ssh-add ~/.ssh/git_rsa
4747
%{~ endif ~}
48+
# activate venv
49+
- source ${ansible_venv_path}/bin/activate
4850
# Install playbook dependencies
49-
- ansible-galaxy install -f -r requirements.yml || true
51+
- ansible-galaxy role install -f -r requirements.yml || true
52+
- ansible-galaxy collection install -f -r requirements.yml || true
5053
# Wait for cloud-init
5154
- while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done
5255
# Work around for missing environment

main.tf

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ locals {
33
latest_component_minor_version = "${split(".", var.component_version)[0]}.${split(".", var.component_version)[1]}.x"
44

55
data = templatefile("${path.module}/component.yml.tpl", {
6-
description = var.description
7-
name = var.name
8-
playbook_dir = var.playbook_dir
9-
playbook_file = var.playbook_file
10-
playbook_repo = var.playbook_repo
11-
repo_host = try(local.repo_parts.host, null)
12-
repo_port = coalesce(local.repo_parts.port, 22)
13-
ssh_key_name = try(data.aws_secretsmanager_secret.ssh_key[0].name, null)
6+
ansible_venv_path = var.ansible_venv_path
7+
description = var.description
8+
name = var.name
9+
playbook_dir = var.playbook_dir
10+
playbook_file = var.playbook_file
11+
playbook_repo = var.playbook_repo
12+
repo_host = try(local.repo_parts.host, null)
13+
repo_port = coalesce(local.repo_parts.port, 22)
14+
ssh_key_name = try(data.aws_secretsmanager_secret.ssh_key[0].name, null)
1415
})
1516

1617
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_venv_path" {
2+
default = "/var/tmp/ansible_venv/"
3+
description = "Path at which to create the ansible virtual environment"
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)