Skip to content

added passenger module #42

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
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ nginx_source_modules_included:
http_spdy_module: "--with-http_spdy_module"
http_perl_module: "--with-http_perl_module"
naxsi_module: "--add-module=/tmp/nginx_naxsi"
passenger_module: "--add-module=/tmp/nginx_passenger"

nginx_source_modules_excluded:
- mail_pop3_module
Expand Down
3 changes: 3 additions & 0 deletions tasks/modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@

- include: modules/naxsi_module.yml
when: nginx_source_modules_included.naxsi_module is defined

- include: modules/passenger_module.yml
when: nginx_source_modules_included.passenger_module is defined
28 changes: 28 additions & 0 deletions tasks/modules/passenger_module.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
- name: Nginx | Modules | install dependencies
apt:
name: "{{ item }}"
state: latest
with_items:
- libcurl4-openssl-dev
- ruby-dev
- libgemplugin-ruby

- name: Nginx | Modules | install passenger gem
sudo: yes
gem:
name: passenger
state: latest
user_install: no

- name: Nginx | Modules | get passenger path
shell: passenger-config --root
register: passenger_path

- name: Nginx | Modules | precompile passenger stuff
shell: rake nginx CACHING=false
args:
chdir: "{{ passenger_path.stdout }}"

- name: Nginx | Modules | copy nginx_passenger to neutral location
shell: "cp -R {{ passenger_path.stdout }}/ext/nginx /tmp/nginx_passenger"
11 changes: 11 additions & 0 deletions tasks/source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@
make install
when: nginx_flags.changed

- name: Nginx | get ruby path
shell: which ruby
register: ruby_path
when: nginx_source_modules_included.passenger_module is defined

- name: Nginx | add passenger.conf
template:
src: passenger.conf.j2
dest: /etc/nginx/conf.d/passenger.conf
when: nginx_source_modules_included.passenger_module is defined

- name: Nginx | Update the symbolic link to the nginx install
file:
path: /usr/local/nginx/default
Expand Down
2 changes: 2 additions & 0 deletions templates/passenger.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
passenger_root {{ passenger_path.stdout }};
passenger_ruby {{ ruby_path.stdout }};