temp0825d

Young-Kyoo Kim·2025년 8월 25일
# service_disable_playbook.yml
# 메인 플레이북: 서비스 상태 체크 후 조건부 비활성화 수행
---
- name: Service Status Check and Conditional Disable
  hosts: all
  gather_facts: yes
  become: yes
  serial: 5  # 5개 노드씩 순차 처리하여 안정성 확보
  
  vars:
    # 비활성화 대상 서비스 설정 (기본값: false로 안전하게 설정)
    disable_auditd: false
    disable_mlocate: false
    disable_ntp_services: false
    
    # 시간 동기화 관련 설정
    max_time_drift_seconds: 30
    ntp_server_pool: "pool.ntp.org"
    
    # 백업 및 로그 설정
    backup_configs: true
    log_changes: true
    
  tasks:
    # Phase 1: 현재 상태 체크 (기존 플레이북 재사용)
    - name: Include service status check
      include_tasks: service_status_check_complete.yml
      
    # Phase 2: 조건부 서비스 비활성화
    - name: Include conditional service disable tasks
      include_tasks: conditional_service_disable.yml
      
    # Phase 3: 시간 동기화 처리
    - name: Include time synchronization tasks
      include_tasks: time_sync_correction.yml
      when: node_result.ntp.ntp_synchronized == false or 
            (time_reference is defined and 
             ((node_result.current_time | to_datetime('%Y-%m-%dT%H:%M:%SZ')) - 
              (time_reference | to_datetime('%Y-%m-%dT%H:%M:%SZ'))).total_seconds() | abs > max_time_drift_seconds)
              
    # Phase 4: 최종 검증 및 보고
    - name: Include final verification
      include_tasks: final_verification.yml

0개의 댓글