From 22e15da73ccceeb8484c1378daebf41044e79768 Mon Sep 17 00:00:00 2001 From: Sanne Raymaekers Date: Thu, 30 May 2024 16:09:00 +0200 Subject: [PATCH] templates/packer: use import_tasks instead of include_tasks The tags don't get inherited through the dynamic `include_tasks` command. Use `import_tasks` to preserve the tags. --- templates/packer/ansible/roles/common/tasks/main.yml | 10 +++++----- templates/packer/worker.pkr.hcl | 7 +++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/templates/packer/ansible/roles/common/tasks/main.yml b/templates/packer/ansible/roles/common/tasks/main.yml index a5686214c..ce673c4ad 100644 --- a/templates/packer/ansible/roles/common/tasks/main.yml +++ b/templates/packer/ansible/roles/common/tasks/main.yml @@ -1,19 +1,19 @@ --- # Subscribe -- include_tasks: subscribe.yml +- import_tasks: subscribe.yml # Install various software packages. -- include_tasks: packages.yml +- import_tasks: packages.yml # Configure worker initialization service. -- include_tasks: worker-initialization-service.yml +- import_tasks: worker-initialization-service.yml # Configure the worker. -- include_tasks: worker-config.yml +- import_tasks: worker-config.yml # Unregister -- include_tasks: unregister.yml +- import_tasks: unregister.yml - name: Ensure SELinux contexts are updated tags: diff --git a/templates/packer/worker.pkr.hcl b/templates/packer/worker.pkr.hcl index 1d2a4ce62..ab6dda444 100644 --- a/templates/packer/worker.pkr.hcl +++ b/templates/packer/worker.pkr.hcl @@ -166,11 +166,14 @@ update-crypto-policies --set LEGACY EOF } - # Ansible is a little broken on fedora>39, needs python-six + # Ansible is a little broken on fedora>39, needs python-six & 3.9 + # Installing python3.9 breaks dnf update with ansible, so do it here + # first provisioner "shell" { only = ["amazon-ebs.fedora-40-x86_64", "amazon-ebs.fedora-40-aarch64"] inline = [ - "sudo dnf install -y python3.9" + "sudo dnf install -y python3.9", + "sudo dnf -y update" ] }