pve-emergency-bot.yml, pve-monitoring.yml and pve-docker-test.yml still ran their creation plays unconditionally. Invoking make deploy-<svc> would pct start / pct reboot the stopped OLD VMID (148/146/145) on its production IP, colliding with the live tofu-managed container. Add the same pre_tasks `meta: end_play` guard the other seven migrated services already carry: skip while homelab_services['<svc>'].provisioner == 'tofu', override with -e pve_<svc>_legacy_provisioning_enabled=true for an intentional legacy rollback. Verified with --check: both plays in each file end immediately, no pct calls. Config for these three lives elsewhere (emergency-access.yml, uptime-kuma.yml, pve-docker-test.yml play 2), so gating the creation plays makes the files full no-ops under tofu, like pve-gyro.yml. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012uoq5AVK8mkBgg83Mq6o5V
64 lines
2.5 KiB
YAML
64 lines
2.5 KiB
YAML
---
|
||
# После переезда на OpenTofu (tofu/svc-monitoring.tf, VMID 155) обе play здесь —
|
||
# legacy: они таргетят СТАРЫЙ VMID 146 на боевом адресе 192.168.1.30, а вторая
|
||
# делает pct reboot 146. Пропускаем, пока реестр говорит provisioner: tofu.
|
||
# Конфигурация (Uptime Kuma) в этот плейбук не входит — она в
|
||
# playbooks/uptime-kuma.yml. Замороженный Prometheus-стек в новый контейнер не
|
||
# разворачивался. Для намеренного legacy rollback:
|
||
# -e pve_monitoring_legacy_provisioning_enabled=true
|
||
|
||
- name: Create monitoring LXC on cloud-pc
|
||
hosts: localhost
|
||
connection: local
|
||
become: false
|
||
gather_facts: false
|
||
vars:
|
||
ansible_become: false
|
||
ansible_python_interpreter: "{{ ansible_playbook_python }}"
|
||
pve_monitoring_legacy_provisioning_enabled: >-
|
||
{{ homelab_services['monitoring'].provisioner != 'tofu' }}
|
||
pve_lxc_vmid: 146
|
||
pve_lxc_node: cloud-pc
|
||
pve_lxc_hostname: monitoring
|
||
pve_lxc_ip: 192.168.1.30/24
|
||
pve_lxc_gateway: 192.168.1.1
|
||
pve_lxc_disk: data:24
|
||
pve_lxc_cores: 2
|
||
pve_lxc_memory: 4096
|
||
pve_lxc_swap: 512
|
||
pve_lxc_startup: order=80
|
||
pve_lxc_features:
|
||
- nesting=1
|
||
pve_lxc_ostemplate: local:vztmpl/debian-13-standard_13.1-2_amd64.tar.zst
|
||
pre_tasks:
|
||
- name: Skip legacy monitoring provisioning after cutover
|
||
ansible.builtin.meta: end_play
|
||
when: not (pve_monitoring_legacy_provisioning_enabled | bool)
|
||
roles:
|
||
- role: pve_lxc
|
||
|
||
- name: Enable Docker keyctl feature for monitoring LXC
|
||
hosts: cloud-pc
|
||
gather_facts: false
|
||
vars:
|
||
pve_monitoring_legacy_provisioning_enabled: >-
|
||
{{ homelab_services['monitoring'].provisioner != 'tofu' }}
|
||
pre_tasks:
|
||
- name: Skip legacy monitoring provisioning after cutover
|
||
ansible.builtin.meta: end_play
|
||
when: not (pve_monitoring_legacy_provisioning_enabled | bool)
|
||
tasks:
|
||
- name: Read monitoring LXC configuration
|
||
ansible.builtin.command: pct config 146
|
||
register: monitoring_lxc_config
|
||
changed_when: false
|
||
|
||
- name: Enable keyctl for Docker in monitoring LXC
|
||
ansible.builtin.command: pct set 146 --features nesting=1,keyctl=1
|
||
when: "'keyctl=1' not in monitoring_lxc_config.stdout"
|
||
register: monitoring_lxc_keyctl
|
||
|
||
- name: Restart monitoring LXC after feature change
|
||
ansible.builtin.command: pct reboot 146
|
||
when: monitoring_lxc_keyctl.changed
|