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,170 points
427 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,180 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
2,245 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,180 points
3,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,180 points
4,852 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 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
1,067 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,180 points
195 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,180 points
392 views