3_3-jinja2_template.yml()

---
- hosts: all
  remote_user: root
  vars:
    http_packages:
      - httpd
  tasks:
    - name: install https form yum
      yum:
        name: 
          "{{ http_packages }}" 
      register:
        yum_httpd
    - name: enable & start httpd service
      service:
        name: httpd
        state: started
      when: yum_httpd['rc'] == 0
    - name: open firewall for http
      firewalld: 
        service: http
        permanent: yes
        state: enabled
        immediate: yes
    - name: open firewall for port-80
      firewalld: 
        port: 80/tcp
        permanent: yes
        state: enabled
        immediate: yes

    - name: copy template file-http_index.j2 to host
      template:
        src: /home/student/ansible_student/fiels/jinja2-http_index.j2
        dest: /var/www/html/index.html
        owner: root
        group: root
        mode: 0644
————————
---
- hosts: all
  remote_user: root
  vars:
    http_packages:
      - httpd
  tasks:
    - name: install https form yum
      yum:
        name: 
          "{{ http_packages }}" 
      register:
        yum_httpd
    - name: enable & start httpd service
      service:
        name: httpd
        state: started
      when: yum_httpd['rc'] == 0
    - name: open firewall for http
      firewalld: 
        service: http
        permanent: yes
        state: enabled
        immediate: yes
    - name: open firewall for port-80
      firewalld: 
        port: 80/tcp
        permanent: yes
        state: enabled
        immediate: yes

    - name: copy template file-http_index.j2 to host
      template:
        src: /home/student/ansible_student/fiels/jinja2-http_index.j2
        dest: /var/www/html/index.html
        owner: root
        group: root
        mode: 0644