prole/infrastructure/playbooks/prole_logs_migrate.yml
chrisfu cad49cc0a6 Summary of recent repairs and infrastructure updates
Repairs and improvements:
- iSCSI: Added cleanup tasks to remove stale mounts and fstab entries. Improved robustness of iSCSI target management and added 'iscsi_absent_mounts' support.
- K3s:
    - Updated service start logic to accept 'activating' state, preventing premature failure during slow startups.
    - Improved service stop logic to safely handle missing or not-found services.
    - Ensured 'prole-installer' ServiceAccount and ClusterRoleBinding exist for K8s administration.
    - Added leader election and etcd tuning arguments (forgiving leases) to config.yaml.j2.
    - Removed deprecated 'prole-port-forwards' systemd service.
- Installer & Scripts:
    - Updated legacy_tk.py to support K3s mode, secret resolution for passwords, and better environment management (including ~/.prole/env.sh for service mode).
    - Updated init_ansible.sh to support PROLE_VAULT_PASS_FILE and ANSIBLE_VAULT_PASSWORD_FILE.
    - Improved directory and kubeconfig path resolution in prole_cfg.sh to support fallback to ~/.prole.
    - Enhanced Grafana password resolution in init_monitoring.sh.
    - Added automatic application of iSCSI StorageClass and PersistentVolumes in init_openbao.sh.
- General: Switched conf/prole.cfg to k3s deployment mode and updated vault_k3s.yml token.

New Ansible Tasks and Playbooks:
- infrastructure/playbooks/iscsi_cleanup.yml: Automates logout and removal of stale iSCSI node records.
- infrastructure/playbooks/prole_logs_migrate.yml: Orchestrates /prole/logs migration to iSCSI storage.
- infrastructure/playbooks/tmp_bao_dir.yml: Ensures host-level storage directories for OpenBao.
- infrastructure/playbooks/tmp_mount.yml: Utility to verify and enforce host-level mounts.
- infrastructure/playbooks/k3s_sync.yml: Added tasks to start K3s after sync and update local kubeconfig on the controller.
- Added 'Unmount stale iSCSI mounts' and 'Remove stale iSCSI fstab entries' to the iscsi role.
- Added 'Ensure prole-installer service account exists' to the k3s role.
2026-02-15 17:51:57 -08:00

80 lines
2.2 KiB
YAML

---
- name: Migrate /prole/logs to iSCSI
hosts: myrddin.prole.org
become: true
vars:
prole_logs_iscsi_target:
iqn: "iqn.2000-01.com.synology:synology.Target-1.292d45194a1"
chap_user: "prole"
chap_password: "{{ vault_iscsi_prole_password }}"
mounts:
- path: /prole/logs/synology
fstype: ext4
opts: "_netdev,noatime"
src: "UUID=5335affd-b1ab-4134-a1c0-be88ab965309"
tasks:
- name: Ensure rsync installed
ansible.builtin.package:
name: rsync
state: present
- name: Ensure staging mountpoint exists
ansible.builtin.file:
path: /prole/logs/synology
state: directory
mode: "0755"
- name: Login and mount logs volume at staging path
ansible.builtin.include_role:
name: iscsi
vars:
iscsi_targets: "{{ [prole_logs_iscsi_target] }}"
iscsi_absent_mounts: []
- name: Initial rsync from /prole/logs to staging
ansible.builtin.command: >
rsync -aHAX --info=stats2 /prole/logs/ /prole/logs/synology/
register: rsync_initial
failed_when: rsync_initial.rc not in [0, 24]
- name: Stop rsyslog
ansible.builtin.service:
name: rsyslog
state: stopped
- name: Final rsync after rsyslog stop
ansible.builtin.command: >
rsync -aHAX --delete --info=stats2 /prole/logs/ /prole/logs/synology/
register: rsync_final
failed_when: rsync_final.rc not in [0, 24]
- name: Unmount staging logs volume
ansible.builtin.mount:
path: /prole/logs/synology
state: unmounted
- name: Remove staging fstab entry
ansible.builtin.lineinfile:
path: /etc/fstab
state: absent
regexp: '^\\S+\\s+/prole/logs/synology\\s+'
- name: Ensure /prole/logs exists
ansible.builtin.file:
path: /prole/logs
state: directory
mode: "0755"
- name: Mount logs volume at /prole/logs
ansible.builtin.mount:
path: /prole/logs
src: "UUID=5335affd-b1ab-4134-a1c0-be88ab965309"
fstype: ext4
opts: "_netdev,noatime"
state: mounted
- name: Start rsyslog
ansible.builtin.service:
name: rsyslog
state: started