編輯角色 apache 任務

  1. 編輯任務主檔 main.yml,新增任務:
    1. 安裝最新版本的 httpd
    2. 設定 htppd 開機啟動且立即啟動
    3. 防火牆開放 http 服務
    [deyu1@kvm19 ansible]$ vim roles/apache/tasks/main.yml
    [deyu1@kvm19 ansible]$ cat roles/apache/tasks/main.yml
    ---
    - name: install the latest version of Apache
      yum:
        name: httpd
        state: latest
    
    - name: Start service httpd
      service:
        name: httpd
        state: started
        enabled: yes
    
    - name: Enable service firewalld
      service:
        name: firewalld
        enabled: yes
        state: started
    
    - name: firewalld add http service
      firewalld:
        service: http
        permanent: yes
        state: enabled
        immediate: yes