LondheShubham153 / ansible-roles

This is an Ansible Role for NGINX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nginx Ansible Role

This Ansible role installs and configures Nginx on target hosts, along with deploying a basic index.html file.

Installation

To use this role, you need to have Ansible installed on your control node. You can install it via the Ansible PPA repository:

sudo apt-add-repository ppa:ansible/ansible
sudo apt update
sudo apt install ansible

Usage

  1. Clone or download this repository to your Ansible control node.

  2. Create a directory structure for your playbook:

nginx_deploy/
├── roles/
│   └── nginx/
│       ├── tasks/
│       │   └── main.yml
│       └── files/
│           └── index.html
├── playbook.yml
└── inventory

OR

ansible-galaxy init nginx
  1. Write your playbook (playbook.yml) with the following content:
---
- name: Install and configure Nginx
  hosts: your_ubuntu_servers
  become: true

  roles:
    - nginx

Replace your_ubuntu_servers with your actual inventory group or host.

  1. Ensure that the nginx role is moved to the /etc/ansible/roles directory:
sudo mv roles/nginx /etc/ansible/roles
  1. Run your playbook:
ansible-playbook -i inventory playbook.yml

Contributing

If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

This is an Ansible Role for NGINX


Languages

Language:HTML 100.0%