Skip to content

Added CentOS and RedHat support #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions tasks/package.yml → tasks/install_apt.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# file: nginx/tasks/package.yml
# file: nginx/tasks/install_apt.yml

- name: Nginx | Make sure the ansible required dependencies are installed
apt:
Expand All @@ -15,5 +15,3 @@
state: present
notify:
- restart nginx

- include: directories.yml
2 changes: 1 addition & 1 deletion tasks/source.yml → tasks/install_source.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# file: nginx/tasks/source.yml
# file: nginx/tasks/install_source.yml

- include: user.yml
- include: directories.yml
Expand Down
13 changes: 13 additions & 0 deletions tasks/install_yum.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# file: nginx/tasks/install_yum.yml

- name: Nginx | Add the nginx repository
template:
src: nginx.repo.j2
dest: /etc/yum.repos.d/nginx.repo

- name: Nginx | Make sure nginx is installed (package)
yum:
pkg: nginx
state: present
notify:
- restart nginx
9 changes: 6 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# file: nginx/tasks/main.yml

- include: package.yml
when: nginx_install_method == "package"
- include: source.yml
- include: install_apt.yml
when: nginx_install_method == "package" and ansible_pkg_mgr == "apt"
- include: install_yum.yml
when: nginx_install_method == "package" and ansible_pkg_mgr == "yum"
- include: install_source.yml
when: nginx_install_method == "source"
- include: directories.yml
- include: scripts.yml
- include: configure.yml
- include: default_site.yml
Expand Down
5 changes: 5 additions & 0 deletions templates/nginx.repo.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/{{ ansible_distribution | lower }}/{{ ansible_distribution_major_version }}/$basearch/
gpgcheck=0
enabled=1