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:
Adyrem
2026-05-15 17:41:52 +02:00
parent 36c63d1243
commit 3d596b984b
7 changed files with 146 additions and 0 deletions
@@ -0,0 +1,2 @@
ansible_user: adyrem
ansible_ssh_common_args: "-o ProxyJump=root@192.168.1.10 -o StrictHostKeyChecking=no"
+5
View File
@@ -22,6 +22,11 @@ all:
hosts:
gitea:
claude_code_vms:
hosts:
claude-code:
ansible_host: 10.10.2.10
pihole_servers:
hosts:
pihole:
+8
View File
@@ -0,0 +1,8 @@
---
- name: Configure Claude Code VM
hosts: claude_code_vms
roles:
- common
- node_exporter
- promtail
- claude_code
+2
View File
@@ -0,0 +1,2 @@
files/homelab_ed25519
files/claude-code_ed25519
+64
View File
@@ -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