How to configure the Nginx server in AWS with Ansible Playbook

0 votes

Hi Guys,

I am new to Ansible Playbook. I want to configure the Nginx server in AWS with the Ansible Playbook. How can I do that?

Oct 12, 2020 in Ansible by akhtar
• 38,260 points
2,999 views

1 answer to this question.

0 votes

Hi@akhtar,

To configure the Nginx server in AWS, you need to install the software for Nginx. After that, you can host any page in the Nginx server as shown below.

- hosts: ec2_instance_ips
  remote_user: ubuntu
  become: True
  tasks:
    - name: Install nginx
      apt:
        name: nginx
        state: present
    - name: Create default index page
      copy:
        dest: /usr/share/nginx/html/index.html
        content: "Howdy from {{ ansible_hostname }}"
    - name: Restart nginx
      service:
        name: nginx
        state: restarted
answered Oct 12, 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,100 views
0 votes
1 answer

How to overwrite the content of a file in remote systems using Ansible playbook?

Hi@akhtar, You can find one argument in the ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,460 points
14,191 views
0 votes
1 answer

How to capture the output of a task in Ansible Playbook?

Hi@akhtar, Ansible registers module used to capture/store the ...READ MORE

answered Aug 2, 2020 in Ansible by MD
• 95,460 points
14,920 views
+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
3,940 views
+2 votes
1 answer
0 votes
1 answer

How to create an Elastic Load Balancer in AWS with Ansible Playbook?

Hi@akhtar, You can find one module in ansible ...READ MORE

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

How to configure httpd web server using Ansible Playbook?

Hi@akhtar, You need to write one program file ...READ MORE

answered Jul 30, 2020 in Ansible by MD
• 95,460 points
3,311 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