How to configure httpd web server using Ansible Playbook

0 votes

Hi Guys,

I have installed Ansible in my local system. I want to configure httpd web server in a remote system. How can I do that using Ansible Playbook?

Jul 30, 2020 in Ansible by akhtar
• 38,260 points
3,418 views

1 answer to this question.

0 votes

Hi@akhtar,

You need to write one program file in the YML language. Ansible Playbooks works on the YML language. I have attached one playbook below for your reference.

- hosts: all
  tasks:
    - package: "name=httpd state=present"
    - copy: "src=home.html dest=/var/www/html/"
    - service: "name=httpd state=started"

You have to run ansible-playbook command as shown below.

$ansible-playbook hello.yml
PLAY [all] *************************************************************************************************************************************************************
TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [192.168.0.179]
TASK [package] *********************************************************************************************************************************************************
ok: [192.168.0.179]
TASK [copy] ************************************************************************************************************************************************************
ok: [192.168.0.179]
TASK [service] *********************************************************************************************************************************************************
ok: [192.168.0.179]
PLAY RECAP *************************************************************************************************************************************************************
192.168.0.179              : ok=4    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

answered Jul 30, 2020 by MD
• 95,460 points

Related Questions In Ansible

0 votes
1 answer

How do I wget a file from web server using shell in the ansible playbook

Hey Ayaan, you could probably use this ...READ MORE

answered Jan 24, 2019 in Ansible by Anushri
4,155 views
0 votes
1 answer

How to configure the Nginx server in AWS with Ansible Playbook?

Hi@akhtar, To configure the Nginx server in AWS, ...READ MORE

answered Oct 12, 2020 in Ansible by MD
• 95,460 points
3,036 views
0 votes
1 answer

devops , how to create user using ansible playbook

root doesn't need a password to switch ...READ MORE

answered Jul 16, 2018 in Ansible by Kalgi
• 2,680 points
1,135 views
0 votes
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,036 views
+2 votes
1 answer
0 votes
1 answer

How to install httpd web server in remote node using Ansible?

Hi@akhtar, You need to use the package module in Ansible. ...READ MORE

answered Jul 30, 2020 in Ansible by MD
• 95,460 points
2,596 views
0 votes
1 answer

How to configure yum using Ansible Playbook?

Hi@akhtar, You need to use the yum_repository module ...READ MORE

answered Aug 4, 2020 in Ansible by MD
• 95,460 points
2,282 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP