Initial commit — OpenClaw VM infrastructure
- ansible/: VM provisioning playbooks and roles - provision-vm.yml: create KVM VM from Ubuntu cloud image - install.yml: install OpenClaw on guest (upstream) - customize.yml: swappiness, virtiofs fstab, linger - roles/vm/: libvirt domain XML, cloud-init templates - inventory.yml + host_vars/zap.yml: zap instance config - backup-openclaw-vm.sh: daily rsync + MinIO upload - restore-openclaw-vm.sh: full redeploy from scratch - README.md: full operational documentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
69
ansible/roles/openclaw/tasks/nodejs.yml
Normal file
69
ansible/roles/openclaw/tasks/nodejs.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
---
|
||||
- name: Install required packages for Node.js
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- ca-certificates
|
||||
- curl
|
||||
- gnupg
|
||||
state: present
|
||||
|
||||
- name: Create directory for NodeSource GPG key
|
||||
ansible.builtin.file:
|
||||
path: /etc/apt/keyrings
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Add NodeSource GPG key
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
set -o pipefail
|
||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | \
|
||||
gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||
chmod a+r /etc/apt/keyrings/nodesource.gpg
|
||||
creates: /etc/apt/keyrings/nodesource.gpg
|
||||
executable: /bin/bash
|
||||
|
||||
- name: Add NodeSource repository
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
set -o pipefail
|
||||
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] \
|
||||
https://deb.nodesource.com/node_{{ nodejs_version }} nodistro main" | \
|
||||
tee /etc/apt/sources.list.d/nodesource.list > /dev/null
|
||||
creates: /etc/apt/sources.list.d/nodesource.list
|
||||
executable: /bin/bash
|
||||
|
||||
- name: Update apt cache after adding NodeSource repo
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
|
||||
- name: Install Node.js
|
||||
ansible.builtin.apt:
|
||||
name: nodejs
|
||||
state: present
|
||||
|
||||
- name: Check if pnpm is already installed
|
||||
ansible.builtin.command: pnpm --version
|
||||
register: pnpm_check
|
||||
failed_when: false
|
||||
changed_when: false
|
||||
|
||||
- name: Install pnpm globally
|
||||
ansible.builtin.command: npm install -g pnpm
|
||||
when: pnpm_check.rc != 0
|
||||
|
||||
- name: Verify Node.js installation
|
||||
ansible.builtin.command: node --version
|
||||
register: node_version
|
||||
changed_when: false
|
||||
|
||||
- name: Verify pnpm installation
|
||||
ansible.builtin.command: pnpm --version
|
||||
register: pnpm_version
|
||||
changed_when: false
|
||||
|
||||
- name: Display Node.js and pnpm versions
|
||||
ansible.builtin.debug:
|
||||
msg:
|
||||
- "Node.js version: {{ node_version.stdout }}"
|
||||
- "pnpm version: {{ pnpm_version.stdout }}"
|
||||
Reference in New Issue
Block a user