Implement Homepage Proxmox widget integration with API token management #50
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds end-to-end integration for Homepage's Proxmox widget: automated API token provisioning, 1Password storage, and Kubernetes ConfigMap mounting.
New Role:
proxmox_homepage_tokenProvisions read-only Proxmox API tokens and stores them in 1Password:
api@pam), group (api-ro-users), ACL (PVEAuditoron/)pveum user token add --privsep 1 --output-format jsonop_item_create(fields:username[text],credential[concealed])url,username,secretfor downstream rolesExtended Role:
homepage_deployMounts Proxmox credentials into Homepage pod:
homepage-proxmox-configmap.yml.j2generates ConfigMap withproxmox.yamlPlaybook Wiring
In
coachlight-infra-stack.yml:proxmox_homepage_tokenbeforehomepage_deployOP_SERVICE_ACCOUNT_TOKENfrom environmentOriginal prompt
This section details on the original issue you should resolve
<issue_title>Fix Homepage Proxmox integration</issue_title>
<issue_description>### Goal
Make the Homepage Proxmox widget and
proxmox.yamlintegration work end-to-end by:op_*roles.proxmox.yamlis mounted at/app/config/proxmox.yamlas per docs. ([Homepage][1])Use existing roles where possible; only add minimal new roles.
Relevant project context (files/folders to open)
ansible/playbooks/coachlight-infra-stack.yml(or whichever playbook deploys Homepage + Proxmox)ansible/inventories/group_vars/proxmox.ymlandproxmox_cluster.ymlansible/roles/homepage_deploy/**ansible/roles/op_read/**,op_item_create/**,op_item_edit/**,op_vault_validator/**ansible/roles/role_artifacts/**ansible/roles/omada_api_auth/**andargocd_api_auth/**(copy patterns for “API token in 1Password + k8s config”)ansible/roles/proxmox_*(see how we already talk to Proxmox)New role:
roles/proxmox_homepage_tokenPurpose
On the Proxmox cluster, ensure there is a read-only API token for Homepage, and that the token secret is stored in 1Password for later use by Homepage.
Defaults / variables
Create
defaults/main.ymlandmeta/argument_specs.ymlwith a minimal set of vars, e.g.:proxmox_homepage_user(defaultapi@pam)proxmox_homepage_group(defaultapi-ro-users)proxmox_homepage_role(defaultPVEAuditor)proxmox_homepage_token_id(defaulthomepage)proxmox_homepage_token_1p_item_title(e.g.coachlight-homelab/proxmox-homepage-token)proxmox_homepage_url(e.g.https://proxmox.host.or.ip:8006)proxmox_primary_node(name to runpveumon; default first inproxmox_cluster)No secrets in defaults; secrets come from 1Password/env only.
Tasks (high level)
Use
role_artifactsto register an artifact path like.artifacts/{{ deploy_env }}/proxmox_homepage_token/to capture outputs.Use
op_read+op_vault_validatorto check if the 1Password itemproxmox_homepage_token_1p_item_titlealready exists and has fieldstoken,secret,url.If the item is missing:
On
delegate_to: "{{ proxmox_primary_node }}", useansible.builtin.commandwithpveumto idempotently ensure:pveum groupadd {{ proxmox_homepage_group }}guarded withchanged_when/failed_whenso reruns are safe.pveum useradd {{ proxmox_homepage_user }}(or equivalent) only if missing.pveum acl modify / -group {{ proxmox_homepage_group }} -role {{ proxmox_homepage_role }} -propagate 1.pveum user token add {{ proxmox_homepage_user }} {{ proxmox_homepage_token_id }} --privsep 1. ([Proxmox VE][2])Parse the command output to capture the newly generated token secret (only visible once).
Immediately create/update a 1Password item via
op_item_create/op_item_editwith fields:url:{{ proxmox_homepage_url }}username:{{ proxmox_homepage_user }}!{{ proxmox_homepage_token_id }}secret: token secretRegister normalized facts:
proxmox_homepage_urlproxmox_homepage_username(user@realm!tokenid)proxmox_homepage_secret(token secret)Write these into role artifacts for later use by
homepage_deploy.All
commandtasks must be idempotent and safe: usechanged_whenbased on stdout, and treat “already exists” messages as ok.Extend
roles/homepage_deployConfigMap for
proxmox.yamlAdd a new template, e.g.
templates/homepage-proxmox-configmap.yml.j2, that creates/updates a ConfigMap with aproxmox.yamlkey exactly as Homepage expects: ([Homepage][1])homepage_namespaceshould reuse whatever var the role already uses.proxmox_homepage_node_namecan default to your real node name (e.g.pve) and come from group_vars.In
tasks/main.ymlofhomepage_deploy, after the base Homepage Application/ConfigMap resources are applied, add a task usingk8s_object_manager(or the same k8s mechanism already used) to apply the new ConfigMap te...💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.