feat(playbooks): rename root authorized key bootstrap playbook

This commit is contained in:
Haitao Pan 2026-04-04 13:16:07 +08:00
parent 3a7e30971a
commit f7a627673a
9 changed files with 60 additions and 11 deletions

View File

@ -5,8 +5,8 @@
become: yes
vars:
# Choose Node.js version
# Examples: "20.x" (LTS), "18.x", "22.x", or specific version like "20.11.0"
nodejs_version: "20.x"
# Examples: "22.x" (LTS), "20.x", "18.x", or specific version like "20.11.0"
nodejs_version: "22.x"
# Install Yarn package manager (default: true)
# install_yarn: false

View File

@ -1,7 +1,7 @@
---
# Node.js version to install (LTS or specific version)
# Examples: "20.x", "18.x", "20.11.0", "20.19.6"
nodejs_version: "20.x"
# Examples: "22.x", "20.x", "18.x", "20.11.0", "20.19.6"
nodejs_version: "22.x"
# Install Yarn package manager (default: true)
install_yarn: true

View File

@ -78,11 +78,11 @@
update_cache: yes
when: nodejs_needs_install | default(true)
- name: Install npm globally
npm:
name: npm
state: latest
global: yes
- name: Verify npm is available
command: npm --version
register: npm_version_check
changed_when: false
failed_when: false
- name: Get current Yarn version
command: yarn --version
@ -159,5 +159,5 @@
debug:
msg: |
Node.js version: {{ nodejs_installed_version | default('Not installed') }}
NPM version: {{ ansible_facts.packages.npm[0].version if ansible_facts.packages.npm is defined and ansible_facts.packages.npm else 'N/A' }}
NPM version: {{ npm_version_check.stdout if npm_version_check.rc == 0 else 'N/A' }}
Yarn version: {{ yarn_version_check.stdout if yarn_version_check.rc == 0 and install_yarn | default(true) else 'Not installed' }}

View File

@ -0,0 +1,9 @@
# python3
Minimal Python 3 toolchain role for Debian-based hosts.
Installs:
- `python3`
- `python3-pip`
- `python3-venv`

View File

@ -0,0 +1,6 @@
---
python3_packages:
- python3
- python3-pip
- python3-venv
python3_install_recommends: false

View File

@ -0,0 +1,26 @@
---
- name: Ensure Python 3 toolchain is installed
ansible.builtin.apt:
name: "{{ python3_packages }}"
state: present
install_recommends: "{{ python3_install_recommends }}"
update_cache: true
environment:
DEBIAN_FRONTEND: noninteractive
APT_LISTCHANGES_FRONTEND: none
become: true
when:
- ansible_facts.os_family == "Debian"
- name: Verify Python 3 installation
ansible.builtin.command: python3 --version
register: python3_version_check
changed_when: false
when:
- ansible_facts.os_family == "Debian"
- name: Show Python 3 version
ansible.builtin.debug:
msg: "{{ python3_version_check.stdout }}"
when:
- ansible_facts.os_family == "Debian"

View File

@ -1,5 +1,6 @@
- name: Setup Docker Engine
- name: Setup Node.js
hosts: all
become: true
gather_facts: true
roles:
- roles/vhosts/nodejs/

7
setup-python3.yml Normal file
View File

@ -0,0 +1,7 @@
---
- name: Setup Python 3
hosts: all
become: true
gather_facts: true
roles:
- roles/vhosts/python3/