deploy_apache.yml 800 B

123456789101112131415161718192021222324252627282930313233
  1. ---
  2. # Deploy the Apache HTTP Server and configure it to listen on port 8080.
  3. # The service can only be accessed from localhost.
  4. - name: Ensure Apache HTTP Server is deployed
  5. hosts: web_servers
  6. gather_facts: false
  7. become: true
  8. tasks:
  9. - name: the httpd package is installed
  10. yum:
  11. name: httpd
  12. state: present
  13. - name: httpd is configured to listen on port 8080
  14. lineinfile:
  15. path: /etc/httpd/conf/httpd.conf
  16. regexp: '^Listen '
  17. insertafter: '^#Listen '
  18. line: Listen 8080
  19. notify: restart httpd
  20. - name: the httpd service is started and enabled
  21. service:
  22. name: httpd
  23. state: started
  24. enabled: yes
  25. handlers:
  26. - name: restart httpd
  27. service:
  28. name: httpd
  29. state: restarted