27 lines
		
	
	
		
			666 B
		
	
	
	
		
			YAML
		
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			666 B
		
	
	
	
		
			YAML
		
	
	
	
---
 | 
						|
- name: 紧急回滚 - 恢复直连Consul配置
 | 
						|
  hosts: nomad_nodes
 | 
						|
  become: yes
 | 
						|
  
 | 
						|
  tasks:
 | 
						|
    - name: 🚨 紧急回滚Consul配置
 | 
						|
      replace:
 | 
						|
        path: /etc/nomad.d/nomad.hcl
 | 
						|
        regexp: 'address = "hcp1.tailnet-68f9.ts.net:80"'
 | 
						|
        replace: 'address = "100.117.106.136:8500"'
 | 
						|
      notify: restart nomad
 | 
						|
 | 
						|
    - name: ✅ 验证回滚配置
 | 
						|
      shell: grep "address.*=" /etc/nomad.d/nomad.hcl
 | 
						|
      register: rollback_config
 | 
						|
 | 
						|
    - name: 📋 显示回滚后配置
 | 
						|
      debug:
 | 
						|
        msg: "回滚后配置: {{ rollback_config.stdout }}"
 | 
						|
 | 
						|
  handlers:
 | 
						|
    - name: restart nomad
 | 
						|
      systemd:
 | 
						|
        name: nomad
 | 
						|
        state: restarted
 |