Skip to content

Commit

Permalink
Merge pull request #21 from rhythmictech/ENG-3526
Browse files Browse the repository at this point in the history
move ansible to python 3 venv
  • Loading branch information
dgoodellrhy authored Jan 27, 2023
2 parents 3a0c386 + e4ab0d1 commit 3c3e2b9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
5 changes: 4 additions & 1 deletion component.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ phases:
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/git_rsa
%{~ endif ~}
# activate venv
- source ${ansible_venv_path}/bin/activate
# Install playbook dependencies
- ansible-galaxy install -f -r requirements.yml || true
- ansible-galaxy role install -f -r requirements.yml || true
- ansible-galaxy collection install -f -r requirements.yml || true
# Wait for cloud-init
- while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done
# Work around for missing environment
Expand Down
17 changes: 9 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ locals {
latest_component_minor_version = "${split(".", var.component_version)[0]}.${split(".", var.component_version)[1]}.x"

data = templatefile("${path.module}/component.yml.tpl", {
description = var.description
name = var.name
playbook_dir = var.playbook_dir
playbook_file = var.playbook_file
playbook_repo = var.playbook_repo
repo_host = try(local.repo_parts.host, null)
repo_port = coalesce(local.repo_parts.port, 22)
ssh_key_name = try(data.aws_secretsmanager_secret.ssh_key[0].name, null)
ansible_venv_path = var.ansible_venv_path
description = var.description
name = var.name
playbook_dir = var.playbook_dir
playbook_file = var.playbook_file
playbook_repo = var.playbook_repo
repo_host = try(local.repo_parts.host, null)
repo_port = coalesce(local.repo_parts.port, 22)
ssh_key_name = try(data.aws_secretsmanager_secret.ssh_key[0].name, null)
})

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_venv_path" {
default = "/var/tmp/ansible_venv/"
description = "Path at which to create the ansible virtual environment"
type = string
}

variable "change_description" {
default = null
description = "description of changes since last version"
Expand Down

0 comments on commit 3c3e2b9

Please sign in to comment.