Add Claude Code VM (105) with cloud-init provisioning
Arch Linux cloud image, 4 cores/8GB, dev-net (10.10.2.10), autostart. Cloud-init handles user/SSH key/network on first boot. Ansible role installs Claude Code CLI, tmux, SSH keys, SSH config for all managed VMs via ProxyJump, homelab repo clone. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
ansible_user: adyrem
|
||||||
|
ansible_ssh_common_args: "-o ProxyJump=root@192.168.1.10 -o StrictHostKeyChecking=no"
|
||||||
@@ -22,6 +22,11 @@ all:
|
|||||||
hosts:
|
hosts:
|
||||||
gitea:
|
gitea:
|
||||||
|
|
||||||
|
claude_code_vms:
|
||||||
|
hosts:
|
||||||
|
claude-code:
|
||||||
|
ansible_host: 10.10.2.10
|
||||||
|
|
||||||
pihole_servers:
|
pihole_servers:
|
||||||
hosts:
|
hosts:
|
||||||
pihole:
|
pihole:
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
- name: Configure Claude Code VM
|
||||||
|
hosts: claude_code_vms
|
||||||
|
roles:
|
||||||
|
- common
|
||||||
|
- node_exporter
|
||||||
|
- promtail
|
||||||
|
- claude_code
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
files/homelab_ed25519
|
||||||
|
files/claude-code_ed25519
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
---
|
||||||
|
- name: Install Claude Code dependencies
|
||||||
|
community.general.pacman:
|
||||||
|
name:
|
||||||
|
- nodejs
|
||||||
|
- npm
|
||||||
|
- ansible
|
||||||
|
- python-pip
|
||||||
|
- tmux
|
||||||
|
- git
|
||||||
|
state: present
|
||||||
|
update_cache: true
|
||||||
|
|
||||||
|
- name: Install Claude Code CLI
|
||||||
|
community.general.npm:
|
||||||
|
name: "@anthropic-ai/claude-code"
|
||||||
|
global: true
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Deploy homelab SSH private key
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: homelab_ed25519
|
||||||
|
dest: /home/{{ admin_user }}/.ssh/homelab_ed25519
|
||||||
|
owner: "{{ admin_user }}"
|
||||||
|
group: "{{ admin_user }}"
|
||||||
|
mode: "0600"
|
||||||
|
|
||||||
|
- name: Deploy claude-code SFTP private key
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: claude-code_ed25519
|
||||||
|
dest: /home/{{ admin_user }}/.ssh/claude-code_ed25519
|
||||||
|
owner: "{{ admin_user }}"
|
||||||
|
group: "{{ admin_user }}"
|
||||||
|
mode: "0600"
|
||||||
|
|
||||||
|
- name: Write SSH client config
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: ssh_config.j2
|
||||||
|
dest: /home/{{ admin_user }}/.ssh/config
|
||||||
|
owner: "{{ admin_user }}"
|
||||||
|
group: "{{ admin_user }}"
|
||||||
|
mode: "0600"
|
||||||
|
|
||||||
|
- name: Write tmux config
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: /home/{{ admin_user }}/.tmux.conf
|
||||||
|
owner: "{{ admin_user }}"
|
||||||
|
group: "{{ admin_user }}"
|
||||||
|
mode: "0644"
|
||||||
|
content: |
|
||||||
|
set -g default-terminal "screen-256color"
|
||||||
|
set -g history-limit 50000
|
||||||
|
set -g mouse on
|
||||||
|
set -g base-index 1
|
||||||
|
set -g escape-time 10
|
||||||
|
bind r source-file ~/.tmux.conf \; display "Reloaded"
|
||||||
|
|
||||||
|
- name: Clone homelab repo
|
||||||
|
ansible.builtin.git:
|
||||||
|
repo: "http://10.10.1.125:3000/adyrem/homelab.git"
|
||||||
|
dest: /home/{{ admin_user }}/dev/homelab
|
||||||
|
version: main
|
||||||
|
become_user: "{{ admin_user }}"
|
||||||
|
become: true
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# Proxmox host — jump host only, no shell
|
||||||
|
Host proxmox
|
||||||
|
HostName 192.168.1.10
|
||||||
|
User root
|
||||||
|
IdentityFile ~/.ssh/homelab_ed25519
|
||||||
|
StrictHostKeyChecking no
|
||||||
|
|
||||||
|
# Proxmox SFTP — write files to host workspace
|
||||||
|
Host proxmox-sftp
|
||||||
|
HostName 192.168.1.10
|
||||||
|
User claude-code
|
||||||
|
IdentityFile ~/.ssh/claude-code_ed25519
|
||||||
|
StrictHostKeyChecking no
|
||||||
|
|
||||||
|
# Infra VMs — via ProxyJump through Proxmox
|
||||||
|
Host gitea-vm
|
||||||
|
HostName 10.10.1.125
|
||||||
|
User adyrem
|
||||||
|
ProxyJump proxmox
|
||||||
|
IdentityFile ~/.ssh/homelab_ed25519
|
||||||
|
StrictHostKeyChecking no
|
||||||
|
|
||||||
|
Host monitoring-vm
|
||||||
|
HostName 10.10.1.137
|
||||||
|
User adyrem
|
||||||
|
ProxyJump proxmox
|
||||||
|
IdentityFile ~/.ssh/homelab_ed25519
|
||||||
|
StrictHostKeyChecking no
|
||||||
|
|
||||||
|
Host pihole-ct
|
||||||
|
HostName 10.10.1.2
|
||||||
|
User root
|
||||||
|
ProxyJump proxmox
|
||||||
|
IdentityFile ~/.ssh/homelab_ed25519
|
||||||
|
StrictHostKeyChecking no
|
||||||
|
|
||||||
|
Host traefik-ct
|
||||||
|
HostName 10.10.1.3
|
||||||
|
User root
|
||||||
|
ProxyJump proxmox
|
||||||
|
IdentityFile ~/.ssh/homelab_ed25519
|
||||||
|
StrictHostKeyChecking no
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
agent: enabled=1
|
||||||
|
bios: ovmf
|
||||||
|
boot: order=scsi0
|
||||||
|
cicustom: user=local:snippets/claude-code-userdata.yaml
|
||||||
|
citype: nocloud
|
||||||
|
cores: 4
|
||||||
|
cpu: host
|
||||||
|
efidisk0: local-zfs:vm-105-disk-0,efitype=4m,pre-enrolled-keys=0,size=1M
|
||||||
|
ide2: local-zfs:vm-105-cloudinit,media=cdrom
|
||||||
|
ipconfig0: ip=10.10.2.10/24,gw=10.10.2.1
|
||||||
|
machine: q35
|
||||||
|
memory: 8192
|
||||||
|
name: claude-code
|
||||||
|
nameserver: 10.10.1.2
|
||||||
|
net0: virtio=BC:24:11:E3:A1:D1,bridge=vmbr2,firewall=1
|
||||||
|
onboot: 1
|
||||||
|
ostype: l26
|
||||||
|
scsi0: local-zfs:vm-105-disk-1,iothread=1,size=20G
|
||||||
|
scsihw: virtio-scsi-single
|
||||||
|
searchdomain: homelab
|
||||||
|
smbios1: uuid=cc68aa1f-affe-42ee-8086-ba94b69573af
|
||||||
|
vga: qxl
|
||||||
|
vmgenid: 511710d7-9a40-43ef-901e-0a2de8344f5b
|
||||||
Reference in New Issue
Block a user