Add argocd_github_repo_create role for declarative SSH repo registration #136
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.
Enables Argo CD to access this private repository via SSH deploy key managed by 1Password Operator.
Implementation
New role:
ansible/roles/argocd_github_repo_create/OnePasswordItemCRD inargocdnamespace mappingvaults/HomeLab/items/Github[deploy-key]→sshPrivateKeyargocd.argoproj.io/secret-type: repositoryDeployment order:
Security posture
no_log: true0600, removed after applyIdempotency
Uses
k8s_object_managerrole (wrapskubernetes.core.k8s). Re-runs are no-op if resources exist unchanged.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
galaxy.ansible.com/opt/pipx_bin/ansible-galaxy ansible-galaxy collection install -r requirements.yml frigate_deploy/defaults/main.yml(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>Add argocd_github_repo_create role to register SRF-Audio/utility-scripts via SSH deploy key</issue_title>
<issue_description>## Goal
Create a new Ansible role
argocd_github_repo_createthat runs afteronepassword_operator_deployand registers this private GitHub repo in Argo CD using an SSH deploy key sourced from 1Password Operator:git@github.com:SRF-Audio/utility-scripts.gitvaults/HomeLab/items/Githubdeploy-keyspec.fields.sshPrivateKey.field: deploy-keyThis enables downstream Argo Applications to reference paths in that repo without embedding credentials.
Authoritative reference (implementation must align):
Non-negotiables
kubectlunless the repo already does it that way).Files / Paths to Create
Create a new role directory:
Variables (role-prefixed; no config creep)
Add only what’s required:
defaults/main.yml
argocd_github_repo_create_kubeconfig: "{{ k3s_kubeconfig_path | default('', true) }}"argocd_github_repo_create_context: "{{ k3s_context_name | default('', true) }}"argocd_github_repo_create_argocd_namespace: argocdargocd_github_repo_create_repo_url_ssh: "git@github.com:SRF-Audio/utility-scripts.git"argocd_github_repo_create_op_item_path: "vaults/HomeLab/items/Github"argocd_github_repo_create_op_deploy_key_field: "deploy-key"argocd_github_repo_create_op_item_name: "argocd-repo-utility-scripts"(name inside Kubernetes; must be unique in namespace)argocd_github_repo_create_repo_secret_name: "repo-utility-scripts"(Argo repo secret name; must be unique in Argo namespace)If your repo has an established naming convention for these, match it (don’t invent a new one).
Argument validation (meta/argument_specs.yml)
Add a single options block that asserts:
Also include a
required_if/ assertions inside tasks for:argocd_github_repo_create_argocd_namespaceexists in cluster (explicit check)OnePasswordItemKubernetes resources to template (exact behavior)
1) OnePasswordItem (in Argo namespace)
Template:
templates/onepassword-item.yml.j2Resource:
apiVersion: onepassword.com/v1kind: OnePasswordItemmetadata.name: {{ argocd_github_repo_create_op_item_name }}metadata.namespace: {{ argocd_github_repo_create_argocd_namespace }}spec.itemPath: {{ argocd_github_repo_create_op_item_path }}spec.fieldsmapping MUST be used (Pattern A):This must result in a Kubernetes Secret materializing with key
sshPrivateKey.2) Argo CD repository Secret (declarative)
Template:
templates/argocd-repository-secret.yml.j2Create a Kubernetes Secret in the Argo namespace with:
metadata.name: {{ argocd_github_repo_create_repo_secret_name }}metadata.namespace: {{ argocd_github_repo_create_argocd_namespace }}label exactly:
argocd.argoproj.io/secret-type: repositorystringDatamust include the required Argo fields:type: giturl: {{ argocd_github_repo_create_repo_url_ssh }}The
sshPrivateKeyvalue must be sourced from the 1Password-rendered secret without copying secrets into Ansible. Implementer must follow the operator’s established behavior:Required approach:
OnePasswordItemdata.sshPrivateKeyorstringData.sshPrivateKey(depending on operator output), and only then apply the Argo repo secret in a way that references that secret data without storing it in Ansible logs/artifacts.Do not implement by:
kubectl get secret ... -o jsonpathand storing it into a registered var that might be logged💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.