main.yml 961 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ---
  2. # tasks file for apache
  3. - name: Apache Package is installed
  4. yum:
  5. name:
  6. - httpd
  7. state: present
  8. - name: Apache Service is started
  9. service:
  10. name: httpd
  11. state: started
  12. enabled: true
  13. - name: Custom Config files are present
  14. template:
  15. src: prod.conf.j2
  16. dest: /etc/httpd/conf.d/prod.conf
  17. owner: root
  18. group: root
  19. mode: 0644
  20. notify: restart apache
  21. - name: Firewalld allows HTTP traffic
  22. firewalld:
  23. service: http
  24. permanent: true
  25. state: enabled
  26. notify: restart firewalld
  27. - name: Check for existence of index.html
  28. stat:
  29. path: "{{ prod_document_root }}/index.html"
  30. register: index_stats
  31. - name: Install a skeleton index.html
  32. copy:
  33. content: "This is the production server on {{ inventory_hostname }}\n"
  34. dest: "{{ prod_document_root }}/index.html"
  35. owner: root
  36. group: root
  37. mode: 0644
  38. when:
  39. - index_stats.stat.exists is defined
  40. - not index_stats.stat.exists