Skip to content

Commit

Permalink
add intel
Browse files Browse the repository at this point in the history
  • Loading branch information
gdams committed Nov 16, 2023
1 parent 4186c59 commit 79d8322
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 11 deletions.
34 changes: 27 additions & 7 deletions ansible/packer/orka-base.pkr.hcl
Expand Up @@ -22,12 +22,24 @@ source "macstadium-orka" "sonoma-arm64" {
image_force_overwrite = true
orka_endpoint = var.ORKA_ENDPOINT
orka_auth_token = var.ORKA_TOKEN
orka_vm_builder_name = "sonoma-arm64-builder"
}

source "macstadium-orka" "sonoma-intel" {
source_image = "90gbsonomassh.img"
image_name = "sonoma-intel-base"
image_description = "Base image with sudoers setup and brew/ansible installed"
image_force_overwrite = true
orka_endpoint = var.ORKA_ENDPOINT
orka_auth_token = var.ORKA_TOKEN
orka_vm_builder_name = "sonoma-intel-builder"
}

# Generate the base image for the sonoma-arm64 VMs which we will use to run the ansible playbook
build {
sources = [
"macstadium-orka.sonoma-arm64",
"macstadium-orka.sonoma-intel"
]

# set sudoers to allow passwordless sudo
Expand All @@ -39,12 +51,20 @@ build {

# Install homebrew and ansible
provisioner "shell" {
inline = [
"curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash",
"echo 'eval \"$(/opt/homebrew/bin/brew shellenv)\"' >> /Users/admin/.zprofile",
"eval \"$(/opt/homebrew/bin/brew shellenv)\"",
"echo 'export PATH=\"/opt/homebrew/bin:$PATH\"' >> /Users/admin/.zprofile",
"brew install ansible",
inline = [<<EOF
/bin/bash -c '\
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash; \
ARCH=$(uname -m); \
if [ "$ARCH" = "x86_64" ]; then \
BREW_PATH=/usr/local/bin; \
else \
BREW_PATH=/opt/homebrew/bin; \
fi; \
echo eval "$($BREW_PATH/brew shellenv)" >> /Users/admin/.zprofile; \
eval "$($BREW_PATH/brew shellenv)"; \
echo export PATH="$BREW_PATH:$PATH" >> /Users/admin/.zprofile; \
brew install ansible;'
EOF
]
}
}
}
20 changes: 16 additions & 4 deletions ansible/packer/orka.pkr.hcl
Expand Up @@ -26,11 +26,23 @@ source "macstadium-orka" "sonoma-arm64" {
image_force_overwrite = true
orka_endpoint = var.ORKA_ENDPOINT
orka_auth_token = var.ORKA_TOKEN
orka_vm_builder_name = "sonoma-arm64-builder"
}

source "macstadium-orka" "sonoma-intel" {
source_image = "sonoma-intel-base"
image_name = "adoptium-sonoma-intel"
image_description = "Base image with sudoers setup and brew/ansible installed"
image_force_overwrite = true
orka_endpoint = var.ORKA_ENDPOINT
orka_auth_token = var.ORKA_TOKEN
orka_vm_builder_name = "sonoma-intel-builder"
}

build {
sources = [
"macstadium-orka.sonoma-arm64",
"macstadium-orka.sonoma-intel"
]

# Create /tmp/packer-provisioner-ansible-local
Expand All @@ -42,18 +54,18 @@ build {

# Copy playbooks/Supporting_Scripts to /tmp/packer-provisioner-ansible-local
provisioner "file" {
source = "../playbooks/Supporting_Scripts"
source = "../playbooks/Supporting_Scripts"
destination = "/tmp/packer-provisioner-ansible-local"
}

# Run ansible playbook
# # Run ansible playbook
provisioner "ansible-local" {
playbook_file = "../playbooks/AdoptOpenJDK_Unix_Playbook/main.yml"
playbook_dir = "../playbooks/AdoptOpenJDK_Unix_Playbook"
extra_arguments = [
"--extra-vars", "ansible_user=admin",
"--skip-tags=hostname,brew_upgrade,brew_cu,core_dumps,crontab,kernel_tuning,adoptopenjdk,jenkins,nagios,superuser,swap_file,jck_tools"
]
command = "/opt/homebrew/bin/ansible-playbook"
command = "source /Users/admin/.zprofile; ansible-playbook"
}
}
}

0 comments on commit 79d8322

Please sign in to comment.