Skip to content

Instantly share code, notes, and snippets.

@grambharos
Forked from icasimpan/nginx-centos7.yml
Created November 7, 2019 07:33
Show Gist options
  • Save grambharos/b244dbb7ffc8de1163ff71bbe4500e4e to your computer and use it in GitHub Desktop.
Save grambharos/b244dbb7ffc8de1163ff71bbe4500e4e to your computer and use it in GitHub Desktop.
Sample ansible playbook to install nginx with sample page on CentOS7
## Credits to John Lieske - https://www.ansible.com/blog/getting-started-writing-your-first-playbook
---
- name: Install nginx
hosts: host.name.ip
become: true
tasks:
- name: Add epel-release repo
yum:
name: epel-release
state: present
- name: Install nginx
yum:
name: nginx
state: present
- name: Insert Index Page
template:
src: index.html
dest: /usr/share/nginx/html/index.html
- name: Start NGiNX
service:
name: nginx
state: started
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment