Install and configure nginx
This commit is contained in:
parent
157ef80aee
commit
fbcb94bc79
3 changed files with 77 additions and 0 deletions
17
README.md
Normal file
17
README.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
# NibTech Shared Role - nginx
|
||||
|
||||
This role deploys, configures, and updates nginx.
|
||||
|
||||
## Tasks
|
||||
|
||||
**main**: Install (or update) nginx and configuration
|
||||
|
||||
## Handlers
|
||||
|
||||
**main**: Restart nginx
|
||||
|
||||
## Templates
|
||||
|
||||
**nginx.conf.js**: Main configuration file for nginx
|
||||
|
||||
## Files
|
11
handlers/main.yml
Normal file
11
handlers/main.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
# NibTech::nginx::handlers::main
|
||||
# This handler is for the nginx process
|
||||
# Role repository:
|
||||
---
|
||||
|
||||
- name: restart nginx
|
||||
ansible.builtin.systemd_service:
|
||||
name: nginx
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
49
tasks/main.yml
Normal file
49
tasks/main.yml
Normal file
|
@ -0,0 +1,49 @@
|
|||
# NibTech::nginx::tasks::main
|
||||
# This role is for installing and configuring nginx
|
||||
# Role repository:
|
||||
---
|
||||
|
||||
# - setup nginx system user
|
||||
# - make sure user is part of the nibtech group
|
||||
# - no home-dir
|
||||
|
||||
- name: Configure nginx Service User
|
||||
ansible.builtin.user:
|
||||
name: "nginx"
|
||||
system: true
|
||||
group: "nibtech"
|
||||
shell: "/sbin/nologin"
|
||||
create_home: false
|
||||
|
||||
- name: Create nginx Shared Directory
|
||||
ansible.builtin.directory:
|
||||
path: "/opt/nginx"
|
||||
state: present
|
||||
owner: "nginx"
|
||||
group: "nibtech"
|
||||
mode: "0664"
|
||||
|
||||
- name: Setup nginx YUM Repository
|
||||
ansible.builtin.yum_repository:
|
||||
name: "nginx-stable"
|
||||
description: "nginx Stable Release"
|
||||
baseurl: http://nginx.org/packages/centos/$releasever/$basearch/
|
||||
gpgcheck: true
|
||||
gpgkey: https://nginx.org/keys/nginx_signing.key
|
||||
module_hotfixes: true
|
||||
enabled: false
|
||||
state: present
|
||||
|
||||
- name: Install nginx
|
||||
ansible.builtin.dnf:
|
||||
name: "nginx"
|
||||
enablerepo: nginx-stable
|
||||
state: "latest"
|
||||
|
||||
- name: Add nginx Configuration File
|
||||
ansible.builtin.copy:
|
||||
src: "nginx.conf"
|
||||
dest: "/etc/nginx/nginx.conf"
|
||||
owner: "nginx"
|
||||
group: "nibtech"
|
||||
mode: "0600"
|
Loading…
Add table
Add a link
Reference in a new issue