ARTH — Task 11.3 👨🏻‍💻

Pratik Patel
1 min readDec 1, 2020

--

Task Description📄

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

Using Playbook:

- hosts: web

vars_files: httpd_var.yml

tasks:

- file:

path: “/dvd”

state: directory

ignore_errors: yes

- mount:

src: “/dev/cdrom”

path: “/dvd”

fstype: iso9660

state: mounted

ignore_errors: yes

- yum_repository:

baseurl: file:///dvd/BaseOS

name: “dvd1”

description: “BaseOS”

gpgcheck: no

- yum_repository:

baseurl: file:///dvd/AppStream

name: “dvd2”

description: “AppStream”

gpgcheck: no

- package:

name: “httpd”

state: present

- template:

dest: “/etc/httpd/conf.d/l.conf”

src: “l.conf”

register: temp

- debug:

var: temp

handlers:

- service:

name: “httpd”

state: restarted

enabled: yes

- firewalld:

port: “{{ port }}/tcp”

state: enabled

permanent: yes

immediate: yes

When you copy something in the html files then only your webserver will restart. This is due to we have taken into consideration of handlers in this task.

--

--

Pratik Patel

I am in journey of learning and creating of new technologies.