Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| c6cff38e59 |
3 changed files with 33 additions and 3 deletions
|
|
@ -104,7 +104,12 @@ jobs:
|
||||||
# Execute the script, passing necessary environment variables
|
# Execute the script, passing necessary environment variables
|
||||||
bash scripts/run_ansible_ci.sh
|
bash scripts/run_ansible_ci.sh
|
||||||
env:
|
env:
|
||||||
IMAGE_VERSION: ${{ steps.version.outputs.tag_name }}
|
# Provide VMIDs and names, overriding group_vars if desired.
|
||||||
|
# These will be passed as `--extra-vars` to Ansible.
|
||||||
|
ANSIBLE_EXTRA_VARS: >-
|
||||||
|
backup_template_vmid=${{ env.TEMPLATE_VMID | default('9001') }}
|
||||||
|
latest_template_vmid=${{ env.LATEST_TEMPLATE_VMID | default('9000') }}
|
||||||
|
version=${{ steps.version.outputs.tag_name }}
|
||||||
|
|
||||||
- name: Extract flake metadata
|
- name: Extract flake metadata
|
||||||
id: meta
|
id: meta
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Nixs base image for promxox
|
# NixOS base image for promxox
|
||||||
This is the nixos base image to be used as a template in proxmox
|
This is the nixos base image to be used as a template in proxmox
|
||||||
|
|
||||||
## Using this base image
|
## Using this base image
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,34 @@ fi
|
||||||
cd "${ANSIBLE_DIR}"
|
cd "${ANSIBLE_DIR}"
|
||||||
echo "Changed directory to: $(pwd)"
|
echo "Changed directory to: $(pwd)"
|
||||||
|
|
||||||
|
# # --- 3. Define Ansible Extra Variables ---
|
||||||
|
# # Base extra variables from our static definitions
|
||||||
|
EXTRA_VARS=(
|
||||||
|
# "local_image_path_ci=${PROXMOX_LOCAL_IMAGE_PATH_FROM_BUILD}" # Path to the image file on the CI runner
|
||||||
|
# "image_filename=$(basename "${PROXMOX_LOCAL_IMAGE_PATH_FROM_BUILD}")" # Extract filename
|
||||||
|
)
|
||||||
|
|
||||||
|
# # Append any other variables passed via ANSIBLE_EXTRA_VARS from the workflow
|
||||||
|
if [[ -n "${ANSIBLE_EXTRA_VARS:-}" ]]; then
|
||||||
|
# Split by space or newline and add to array
|
||||||
|
IFS=$'\n' read -r -d '' -a ADDITIONAL_VARS <<< "${ANSIBLE_EXTRA_VARS}" || true
|
||||||
|
for var in "${ADDITIONAL_VARS[@]}"; do
|
||||||
|
EXTRA_VARS+=("${var}")
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# # --- 4. Execute the Ansible Playbook ---
|
||||||
|
# echo "Executing Ansible playbook: upload-template.yml"
|
||||||
|
|
||||||
|
# # Construct the full --extra-vars string
|
||||||
|
EXTRA_VARS_ARGS=""
|
||||||
|
for var in "${EXTRA_VARS[@]}"; do
|
||||||
|
EXTRA_VARS_ARGS+=" -e ${var}"
|
||||||
|
done
|
||||||
|
|
||||||
ansible-playbook upload-template.yml \
|
ansible-playbook upload-template.yml \
|
||||||
--inventory inventory/hosts.yml \
|
--inventory inventory/hosts.yml \
|
||||||
-e "version=${IMAGE_VERSION:-v0.0.0}" # \
|
${EXTRA_VARS_ARGS} # \
|
||||||
# --diff \
|
# --diff \
|
||||||
# --check false # Set to true for a dry run, false for actual execution
|
# --check false # Set to true for a dry run, false for actual execution
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue