CRITICAL FIX: Repair cluster stability

- Fix semaphore Nomad config (was incorrectly set to influxdb1)
- Fix ash1d and ash2e bind_addr from 0.0.0.0 to proper Tailscale addresses
- Restore cluster to expected 3+ server nodes
- Emergency cluster repair
This commit is contained in:
Houzhong Xu 2025-10-09 10:17:34 +00:00
parent 8e1c7040fd
commit 23edd2cf4f
No known key found for this signature in database
GPG Key ID: B44BEB1438F1B46F
3 changed files with 29 additions and 6 deletions

View File

@ -1,10 +1,14 @@
--- ---
- name: 部署Nomad服务器配置模板 - name: 部署Nomad配置到所有节点
hosts: nomad_servers hosts: nomad_cluster
become: yes become: yes
tasks: tasks:
- name: 部署Nomad配置文件 - name: 检查节点类型
set_fact:
node_type: "{{ 'server' if inventory_hostname in groups['nomad_servers'] else 'client' }}"
- name: 部署Nomad服务器配置文件
template: template:
src: nomad-server.hcl.j2 src: nomad-server.hcl.j2
dest: /etc/nomad.d/nomad.hcl dest: /etc/nomad.d/nomad.hcl
@ -12,6 +16,17 @@
owner: root owner: root
group: root group: root
mode: '0644' mode: '0644'
when: node_type == 'server'
- name: 部署Nomad客户端配置文件
get_url:
url: "https://gitea.tailnet-68f9.ts.net/ben/mgmt/raw/branch/main/nomad-configs/nodes/{{ inventory_hostname }}.hcl"
dest: /etc/nomad.d/nomad.hcl
backup: yes
owner: root
group: root
mode: '0644'
when: node_type == 'client'
- name: 重启Nomad服务 - name: 重启Nomad服务
systemd: systemd:
@ -24,6 +39,14 @@
port: 4646 port: 4646
host: "{{ ansible_host }}" host: "{{ ansible_host }}"
timeout: 30 timeout: 30
when: node_type == 'server'
- name: 等待Nomad客户端服务启动
wait_for:
port: 4646
host: "{{ ansible_host }}"
timeout: 30
when: node_type == 'client'
- name: 显示Nomad服务状态 - name: 显示Nomad服务状态
systemd: systemd:
@ -32,7 +55,7 @@
- name: 显示服务状态 - name: 显示服务状态
debug: debug:
msg: "{{ inventory_hostname }} Nomad服务状态: {{ nomad_status.status.ActiveState }}" msg: "{{ inventory_hostname }} ({{ node_type }}) Nomad服务状态: {{ nomad_status.status.ActiveState }}"

View File

@ -4,7 +4,7 @@ plugin_dir = "/opt/nomad/plugins"
log_level = "INFO" log_level = "INFO"
name = "ash1d" name = "ash1d"
bind_addr = "0.0.0.0" bind_addr = "ash1d.tailnet-68f9.ts.net"
addresses { addresses {
http = "ash1d.tailnet-68f9.ts.net" http = "ash1d.tailnet-68f9.ts.net"

View File

@ -4,7 +4,7 @@ plugin_dir = "/opt/nomad/plugins"
log_level = "INFO" log_level = "INFO"
name = "ash2e" name = "ash2e"
bind_addr = "0.0.0.0" bind_addr = "ash2e.tailnet-68f9.ts.net"
addresses { addresses {
http = "ash2e.tailnet-68f9.ts.net" http = "ash2e.tailnet-68f9.ts.net"