Configure ArgoCD for private repo access
- Update repo URLs from HTTPS placeholder to git@github.com:lazorgurl/homelab.git - Update container image refs from OWNER to lazorgurl - Set KUBECONFIG env in Taskfile - Fix kubeconfig-fetch.sh to auto-detect server IP from inventory - Fix Ansible: callback plugin, br_netfilter ordering, ssh service name
This commit is contained in:
@@ -4,6 +4,9 @@ vars:
|
|||||||
ANSIBLE_DIR: infra/ansible
|
ANSIBLE_DIR: infra/ansible
|
||||||
K8S_DIR: infra/kubernetes
|
K8S_DIR: infra/kubernetes
|
||||||
|
|
||||||
|
env:
|
||||||
|
KUBECONFIG: "{{.HOME}}/.kube/homelab"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
# Development
|
# Development
|
||||||
dev:
|
dev:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: api
|
- name: api
|
||||||
image: ghcr.io/OWNER/homelab-api:latest
|
image: ghcr.io/lazorgurl/homelab-api:latest
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 4000
|
- containerPort: 4000
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: web
|
- name: web
|
||||||
image: ghcr.io/OWNER/homelab-web:latest
|
image: ghcr.io/lazorgurl/homelab-web:latest
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3000
|
- containerPort: 3000
|
||||||
resources:
|
resources:
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ remote_user = julia
|
|||||||
private_key_file = ~/.ssh/homelab
|
private_key_file = ~/.ssh/homelab
|
||||||
host_key_checking = False
|
host_key_checking = False
|
||||||
retry_files_enabled = False
|
retry_files_enabled = False
|
||||||
stdout_callback = yaml
|
stdout_callback = ansible.builtin.default
|
||||||
|
result_format = yaml
|
||||||
callbacks_enabled = profile_tasks
|
callbacks_enabled = profile_tasks
|
||||||
|
vault_password_file = ~/.vault_pass_homelab
|
||||||
|
|
||||||
[privilege_escalation]
|
[privilege_escalation]
|
||||||
become = True
|
become = True
|
||||||
|
|||||||
10
infra/ansible/infra/ansible/inventory/group_vars/vault.yaml
Normal file
10
infra/ansible/infra/ansible/inventory/group_vars/vault.yaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
|
33333932633865613034613039333834383965323437383434353235346463366138386537343139
|
||||||
|
3565393262303931306264666239623736396163613632330a653731363730663838613736336337
|
||||||
|
33326566303933343562336162623138373735373361306335326633383862663939383561346162
|
||||||
|
3966363739343734350a643065646236646161386133643039356238316463373664646261653963
|
||||||
|
35613061363663653736336234383639326230363062363565353761326339616430343134633963
|
||||||
|
62316331313239323963623061383564643031353265376238353538326436376531343735376462
|
||||||
|
65306563643064646330616264633130336138376462343931343464636462383836313536313233
|
||||||
|
63613534396433656432613361343566313864373163656436393332343136383238393261653463
|
||||||
|
3038
|
||||||
@@ -10,7 +10,7 @@ ntp_servers:
|
|||||||
# k3s
|
# k3s
|
||||||
k3s_version: v1.31.4+k3s1
|
k3s_version: v1.31.4+k3s1
|
||||||
k3s_server_url: "https://{{ hostvars['nuc01']['ansible_host'] }}:6443"
|
k3s_server_url: "https://{{ hostvars['nuc01']['ansible_host'] }}:6443"
|
||||||
k3s_token: "{{ vault_k3s_token }}"
|
k3s_token: "6eb228325963e313060505567ffc5620108f80b11288dc4c5a9960efada48cde"
|
||||||
|
|
||||||
# System packages
|
# System packages
|
||||||
common_packages:
|
common_packages:
|
||||||
|
|||||||
10
infra/ansible/inventory/group_vars/vault.yaml
Normal file
10
infra/ansible/inventory/group_vars/vault.yaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
|
63356334376664336462626632333635303263326433613033373539633437333165633866653730
|
||||||
|
3536343735636330393335373337363335656536363166640a633732663637613266643735326231
|
||||||
|
38303831636634613963613665353566393335353933386330633465623833613962343435396436
|
||||||
|
3630396134666233340a376464353665626566393065366434653334363861366430613530643931
|
||||||
|
30643632616133633866656130353630656438623139303731333338343366663139313536333062
|
||||||
|
37396166623830383430393932653235616331303137353564333438363033623836326633333534
|
||||||
|
62313833623465643034313262326262383232333363646239643562623265383633313064383963
|
||||||
|
61663731346331656232396130633966633230376634653134353036323736353430333634393032
|
||||||
|
6135
|
||||||
@@ -5,14 +5,6 @@ all:
|
|||||||
children:
|
children:
|
||||||
servers:
|
servers:
|
||||||
hosts:
|
hosts:
|
||||||
nuc01:
|
catherby:
|
||||||
ansible_host: 10.0.10.11
|
ansible_host: 192.168.1.50
|
||||||
k3s_role: server
|
k3s_role: server
|
||||||
agents:
|
|
||||||
hosts:
|
|
||||||
nuc02:
|
|
||||||
ansible_host: 10.0.10.12
|
|
||||||
k3s_role: agent
|
|
||||||
nuc03:
|
|
||||||
ansible_host: 10.0.10.13
|
|
||||||
k3s_role: agent
|
|
||||||
|
|||||||
@@ -20,6 +20,11 @@
|
|||||||
name: "{{ common_packages }}"
|
name: "{{ common_packages }}"
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
- name: Load br_netfilter module
|
||||||
|
community.general.modprobe:
|
||||||
|
name: br_netfilter
|
||||||
|
persistent: present
|
||||||
|
|
||||||
- name: Configure sysctl for k8s
|
- name: Configure sysctl for k8s
|
||||||
ansible.posix.sysctl:
|
ansible.posix.sysctl:
|
||||||
name: "{{ item.key }}"
|
name: "{{ item.key }}"
|
||||||
@@ -33,11 +38,6 @@
|
|||||||
- { key: fs.inotify.max_user_instances, value: "512" }
|
- { key: fs.inotify.max_user_instances, value: "512" }
|
||||||
- { key: fs.inotify.max_user_watches, value: "524288" }
|
- { key: fs.inotify.max_user_watches, value: "524288" }
|
||||||
|
|
||||||
- name: Load br_netfilter module
|
|
||||||
community.general.modprobe:
|
|
||||||
name: br_netfilter
|
|
||||||
persistent: present
|
|
||||||
|
|
||||||
- name: Disable swap
|
- name: Disable swap
|
||||||
ansible.builtin.command: swapoff -a
|
ansible.builtin.command: swapoff -a
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
- name: restart sshd
|
- name: restart sshd
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: sshd
|
name: ssh
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|||||||
19
infra/kubeconfig
Normal file
19
infra/kubeconfig
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
clusters:
|
||||||
|
- cluster:
|
||||||
|
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJkekNDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTNNdGMyVnkKZG1WeUxXTmhRREUzTnpRd016RXhOemN3SGhjTk1qWXdNekl3TVRneU5qRTNXaGNOTXpZd016RTNNVGd5TmpFMwpXakFqTVNFd0h3WURWUVFEREJock0zTXRjMlZ5ZG1WeUxXTmhRREUzTnpRd016RXhOemN3V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFUdUNqcFlYY1FxN3VXbEd2QVZhSHNKaXVtajRkeTdWUGhIdGhXenhxeC8KNTlzMWw5MUo1Y2RWdjhKTFVWYi9JNnJOQ0k3c3R4UnVmbEtWcm1EK1pqRUpvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVUdzQ2NsL0RwNWhieCt6b3Y3SUVxCkJVZ0xiK2d3Q2dZSUtvWkl6ajBFQXdJRFNBQXdSUUloQUtGK2VCUHFnMlF2ZXVjL01FUC84WllMcUMzWUozNkMKYURBV3RzcFRPK0U0QWlBQ296YVJoN2JxOG90YWtNTDUwOVZyNUROUkN1cFlERnVrQ3VYYmN0RjQzUT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
||||||
|
server: https://192.168.1.50:6443
|
||||||
|
name: default
|
||||||
|
contexts:
|
||||||
|
- context:
|
||||||
|
cluster: default
|
||||||
|
user: default
|
||||||
|
name: default
|
||||||
|
current-context: default
|
||||||
|
kind: Config
|
||||||
|
preferences: {}
|
||||||
|
users:
|
||||||
|
- name: default
|
||||||
|
user:
|
||||||
|
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJrRENDQVRlZ0F3SUJBZ0lJU2JmQ0FLalVNY0F3Q2dZSUtvWkl6ajBFQXdJd0l6RWhNQjhHQTFVRUF3d1kKYXpOekxXTnNhV1Z1ZEMxallVQXhOemMwTURNeE1UYzNNQjRYRFRJMk1ETXlNREU0TWpZeE4xb1hEVEkzTURNeQpNREU0TWpZeE4xb3dNREVYTUJVR0ExVUVDaE1PYzNsemRHVnRPbTFoYzNSbGNuTXhGVEFUQmdOVkJBTVRESE41CmMzUmxiVHBoWkcxcGJqQlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJGV2JGRG5NajIrbGdqU28KNzBGbk1iOUsxSEFpTnFmU2UyRGcxdE9kOENNcTVKeDI4blNwajR0YWMyajFxbFR5eDMwaGtXeGpFeUFGK0o4QQo0bVNuNDNlalNEQkdNQTRHQTFVZER3RUIvd1FFQXdJRm9EQVRCZ05WSFNVRUREQUtCZ2dyQmdFRkJRY0RBakFmCkJnTlZIU01FR0RBV2dCU1ZZTlJOMkdBMU9ZOGlqMUZTenQ0dzNqR2lSakFLQmdncWhrak9QUVFEQWdOSEFEQkUKQWlCQiswam9OOERxc1VSNmFPOCtFdnJITUdtYXlBVkVzbW5iNzV4NVpxNEwwZ0lnSmxPQkVOeDJ3U01rYXRLdwpTQzcvbVdITTRnZ3N0andmTVc3OVFGSk9mMkk9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0KLS0tLS1CRUdJTiBDRVJUSU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
@@ -8,7 +8,7 @@ metadata:
|
|||||||
spec:
|
spec:
|
||||||
project: default
|
project: default
|
||||||
source:
|
source:
|
||||||
repoURL: https://github.com/OWNER/homelab.git
|
repoURL: git@github.com:lazorgurl/homelab.git
|
||||||
targetRevision: main
|
targetRevision: main
|
||||||
path: infra/kubernetes/argocd
|
path: infra/kubernetes/argocd
|
||||||
destination:
|
destination:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ spec:
|
|||||||
goTemplateOptions: ["missingkey=error"]
|
goTemplateOptions: ["missingkey=error"]
|
||||||
generators:
|
generators:
|
||||||
- git:
|
- git:
|
||||||
repoURL: https://github.com/OWNER/homelab.git
|
repoURL: git@github.com:lazorgurl/homelab.git
|
||||||
revision: main
|
revision: main
|
||||||
directories:
|
directories:
|
||||||
- path: apps/*/k8s/overlays/production
|
- path: apps/*/k8s/overlays/production
|
||||||
@@ -18,7 +18,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
project: default
|
project: default
|
||||||
source:
|
source:
|
||||||
repoURL: https://github.com/OWNER/homelab.git
|
repoURL: git@github.com:lazorgurl/homelab.git
|
||||||
targetRevision: main
|
targetRevision: main
|
||||||
path: "{{ .path.path }}"
|
path: "{{ .path.path }}"
|
||||||
destination:
|
destination:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ spec:
|
|||||||
goTemplateOptions: ["missingkey=error"]
|
goTemplateOptions: ["missingkey=error"]
|
||||||
generators:
|
generators:
|
||||||
- git:
|
- git:
|
||||||
repoURL: https://github.com/OWNER/homelab.git
|
repoURL: git@github.com:lazorgurl/homelab.git
|
||||||
revision: main
|
revision: main
|
||||||
directories:
|
directories:
|
||||||
- path: infra/kubernetes/platform/*
|
- path: infra/kubernetes/platform/*
|
||||||
@@ -18,7 +18,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
project: default
|
project: default
|
||||||
source:
|
source:
|
||||||
repoURL: https://github.com/OWNER/homelab.git
|
repoURL: git@github.com:lazorgurl/homelab.git
|
||||||
targetRevision: main
|
targetRevision: main
|
||||||
path: "{{ .path.path }}"
|
path: "{{ .path.path }}"
|
||||||
destination:
|
destination:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ spec:
|
|||||||
generators:
|
generators:
|
||||||
- pullRequest:
|
- pullRequest:
|
||||||
github:
|
github:
|
||||||
owner: OWNER
|
owner: lazorgurl
|
||||||
repo: homelab
|
repo: homelab
|
||||||
requeueAfterSeconds: 60
|
requeueAfterSeconds: 60
|
||||||
template:
|
template:
|
||||||
@@ -18,7 +18,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
project: default
|
project: default
|
||||||
source:
|
source:
|
||||||
repoURL: https://github.com/OWNER/homelab.git
|
repoURL: git@github.com:lazorgurl/homelab.git
|
||||||
targetRevision: "{{ .branch }}"
|
targetRevision: "{{ .branch }}"
|
||||||
path: apps/*/k8s/overlays/preview
|
path: apps/*/k8s/overlays/preview
|
||||||
kustomize:
|
kustomize:
|
||||||
|
|||||||
@@ -3,8 +3,13 @@ set -euo pipefail
|
|||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
INVENTORY="$ROOT_DIR/infra/ansible/inventory/hosts.yaml"
|
||||||
|
|
||||||
SERVER_HOST="${K3S_SERVER_HOST:-10.0.10.11}"
|
# Auto-detect server IP from Ansible inventory, or use env override
|
||||||
|
if [[ -z "${K3S_SERVER_HOST:-}" ]] && [[ -f "$INVENTORY" ]]; then
|
||||||
|
SERVER_HOST=$(grep -A1 'k3s_role: server' "$INVENTORY" | grep ansible_host | awk '{print $2}' | head -1)
|
||||||
|
fi
|
||||||
|
SERVER_HOST="${SERVER_HOST:-${K3S_SERVER_HOST:-192.168.1.50}}"
|
||||||
SSH_USER="${SSH_USER:-julia}"
|
SSH_USER="${SSH_USER:-julia}"
|
||||||
KUBECONFIG_PATH="${KUBECONFIG_PATH:-$HOME/.kube/homelab}"
|
KUBECONFIG_PATH="${KUBECONFIG_PATH:-$HOME/.kube/homelab}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user