---
- hosts: labservers
  become: yes
  tasks:
    - name: install apache
      yum:
        name: httpd
        state: latest
    - name: start and enable httpd
      service:
        name: httpd
        state: started
        enabled: yes
    - name: create index.html
      file:
        path: /var/www/html/index.html
        state: touch
    - name: add a linex to index.html
      lineinfile:
        path: /var/www/html/index.html
        line: "Hello World"