httpd.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ---
  2. - name: Apache HTTP Server web server deployment
  3. hosts: webserver
  4. become: true
  5. tasks:
  6. - name: Latest software installed for Apache HTTPD
  7. yum:
  8. name: "{{ item }}"
  9. state: latest
  10. loop:
  11. - httpd
  12. - mod_ssl
  13. notify: Restart httpd
  14. - name: Web content is in place
  15. import_tasks: deploy_content.yml
  16. - name: Serverc Virtual hosts are configured
  17. template:
  18. src: "httpd.conf.j2"
  19. dest: "/etc/httpd/conf.d/httpd.conf"
  20. notify: Reload httpd
  21. - name: Virtual hosts are configured
  22. template:
  23. src: "hvirtual.conf.j2"
  24. dest: "/etc/httpd/conf.d/virtual.conf"
  25. notify: Reload httpd
  26. - name: Web server is started and enabled
  27. service:
  28. name: httpd
  29. state: started
  30. enabled: yes
  31. - name: Firewall ports are open
  32. firewalld:
  33. service: "{{ item }}"
  34. permanent: yes
  35. immediate: yes
  36. state: enabled
  37. loop:
  38. - http
  39. - https
  40. handlers:
  41. - name: Reload httpd
  42. service:
  43. name: httpd
  44. state: reloaded
  45. - name: Restart httpd
  46. service:
  47. name: httpd
  48. state: restarted