Files
Deploy-Laboratory/ansible/playbooks/apply-local-path-config-lab.yml
jack 231b6713c4 chore: 对齐 00-05 §2 的部署与验证脚本
- 新增 deploy-lab.sh(k3s/longhorn/nginx 铺栈)与 ssh/run-phase2-k3s-on-ylc61-as-jack.sh
- verify.sh:flow/preflight、VERIFY_TEARDOWN 默认、注释与 §2 对应
- 更新 smoke-verify、README、.env.verify.example、根 README 与主要 playbook 头注释
- k3s-delete-lab-stacks 标明重度清场语义

Made-with: Cursor
2026-03-26 07:32:08 +08:00

39 lines
1.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
# 部署docs/00-05 §2 步骤 3——local-path ConfigMapPVC 演示验收见 scripts/verify.sh run 03-05。
# 仅应用本仓库 local-path 实验室 ConfigMap不安装 Longhorn。在 k3s_server 上执行。
# 与 docs/03-05 中「方法一」一致真源ansible/files/03-05-local-path-config/local-path-config-lab.json
- name: Apply local-path-config lab JSON
hosts: k3s_server
become: true
run_once: true
vars:
k3s_kubeconfig: /etc/rancher/k3s/k3s.yaml
local_path_json_src: "{{ playbook_dir }}/../files/03-05-local-path-config/local-path-config-lab.json"
local_path_json_dest: /root/local-path-config-lab.json
tasks:
- name: Copy local-path lab json
ansible.builtin.copy:
src: "{{ local_path_json_src }}"
dest: "{{ local_path_json_dest }}"
mode: "0644"
- name: Apply local-path-config ConfigMap
ansible.builtin.shell: |
set -e
KUBECONFIG={{ k3s_kubeconfig }} kubectl -n kube-system create configmap local-path-config \
--from-file=config.json={{ local_path_json_dest }} \
--dry-run=client -o yaml | KUBECONFIG={{ k3s_kubeconfig }} kubectl apply -f -
args:
executable: /bin/bash
changed_when: true
- name: Restart local-path-provisioner if present
ansible.builtin.shell: |
KUBECONFIG={{ k3s_kubeconfig }} kubectl -n kube-system rollout restart deploy/local-path-provisioner
args:
executable: /bin/bash
register: lp_restart
failed_when: false
changed_when: lp_restart.rc == 0