Skip to content

Commit

Permalink
[packer] Manually install ansible 7.x via pip
Browse files Browse the repository at this point in the history
ansible-core 2.15 is breaking the playbook. Keep the previous version until
things are sorted out.
  • Loading branch information
binary-manu committed Aug 13, 2023
1 parent 1bd48d9 commit 145c59f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packer/clean.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/sh

set -e
set -ex

pacman -Rs --noconfirm ansible
rm -rf /root/.ansible

# Packer's QEMU builder seems to fail to remove the SSH key
Expand Down
3 changes: 3 additions & 0 deletions packer/packer-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"cmd_cow" : "<tab><end> cow_spacesize=1G<enter>",
"cmd_cow_uefi": "e<down><down><down><end> cow_spacesize=1G<F10>",
"cmd_ssh" : "<wait60>systemctl start sshd && mkdir -p -m 0700 /root/.ssh<enter>",
"cmd_ansible" : "/tmp/ansible_venv/bin/ansible-playbook",
"memory" : "2048",
"disk_size" : "65536",
"off_cmd" : "poweroff"
Expand Down Expand Up @@ -105,6 +106,7 @@
},
{
"type" : "ansible-local",
"command": "{{ user `cmd_ansible` }}",
"playbook_dir" : "../ansible",
"playbook_file" : "../ansible/site.yaml",
"extra_arguments" : [
Expand All @@ -131,6 +133,7 @@
},
{
"type" : "ansible-local",
"command": "{{ user `cmd_ansible` }}",
"playbook_dir" : "../ansible",
"playbook_file" : "../ansible/site.yaml",
"extra_arguments" : [
Expand Down
8 changes: 6 additions & 2 deletions packer/prepare.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/sh

set -e
set -ex

ANSIBLE_VENV=/tmp/ansible_venv

set_proxy() {
if [ -n "$http_proxy" ]; then
Expand All @@ -16,5 +18,7 @@ unset_proxy() {

set_proxy
pacman -Syy --noconfirm --needed archlinux-keyring
pacman -S --noconfirm --needed ansible
pacman -S --noconfirm --needed python-pip
python -m venv "$ANSIBLE_VENV"
"$ANSIBLE_VENV/bin/pip" install 'ansible>=7,<8'
unset_proxy

0 comments on commit 145c59f

Please sign in to comment.