Restarting HTTPD Service is not Idempotence in nature and also consume more resources suggest a way to rectify this challenge in Ansible playbook

Before start practical, we are checking connectivity

checking connectivity
ansible all -m ping
var file
target ip
configuration file
yum configuration
package install
- name: installing httpd package
package:
name: "httpd"
state: present
- name: creating document root file
file:
state: directory
path: "{{ doc_root }}"
- name: updating conf file
template:
dest: "/etc/httpd/conf.d/confFile.conf"
src: "confFile.conf"
- name: copying content
copy:
dest: "{{doc_root}}/index.html"
src: /task_11/as.html
firewall rule and service

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store