Commit a13d32e4 by Max Rothman

Clean up some old nginx cruft

parent d89d315f
# requires:
# - common/tasks/main.yml
---
- name: Create nginx app and data dirs
file:
path: "{{ item.path }}"
......@@ -8,13 +5,13 @@
owner: "{{ item.owner }}"
group: "{{ item.group }}"
with_items:
- { path: '{{ nginx_app_dir }}', owner: '{{ nginx_user }}', group: '{{ common_web_group }}' }
- { path: '{{ nginx_sites_available_dir }}', owner: '{{ nginx_user }}', group: '{{ common_web_group }}' }
- { path: '{{ nginx_sites_enabled_dir }}', owner: '{{ nginx_user }}', group: '{{ common_web_group }}' }
- { path: '{{ nginx_conf_dir }}', owner: '{{ nginx_user }}', group: '{{ common_web_group }}' }
- { path: '{{ nginx_data_dir }}', owner: '{{ common_web_user }}', group: '{{ nginx_user }}' }
- { path: '{{ nginx_log_dir }}', owner: '{{ common_web_user }}', group: '{{ nginx_user }}' }
- { path: '{{ nginx_server_static_dir }}', owner: '{{ common_web_user }}', group: '{{ nginx_user }}' }
- { path: '{{ nginx_app_dir }}', owner: '{{ nginx_user }}', group: '{{ common_web_group }}' }
- { path: '{{ nginx_sites_available_dir }}', owner: '{{ nginx_user }}', group: '{{ common_web_group }}' }
- { path: '{{ nginx_sites_enabled_dir }}', owner: '{{ nginx_user }}', group: '{{ common_web_group }}' }
- { path: '{{ nginx_conf_dir }}', owner: '{{ nginx_user }}', group: '{{ common_web_group }}' }
- { path: '{{ nginx_data_dir }}', owner: '{{ common_web_user }}', group: '{{ nginx_user }}' }
- { path: '{{ nginx_log_dir }}', owner: '{{ common_web_user }}', group: '{{ nginx_user }}' }
- { path: '{{ nginx_server_static_dir }}', owner: '{{ common_web_user }}', group: '{{ nginx_user }}' }
notify: restart nginx
tags:
- install
......@@ -48,20 +45,6 @@
- install
- install:system-requirements
# REMOVE THIS AFTER LATEST NGINX HAS BEEN DEPLOYED EVERYWHERE
# New package does not identify conflicts properly.
# "nginx-common" only appears as requirement for ubuntu-distributed package, thus
# removing it will remove all nginx packages installed from Ubuntu's repo.
# This is only required if nginx was previously installed from Ubuntu's repo
# and you're switching to Nginx's PPA
- name: Remove old nginx packages
apt:
name: nginx-common
state: absent
tags:
- install
- install:system-requirements
- name: Install the nginx package
apt:
name: nginx
......@@ -81,72 +64,18 @@
- install
- install:configuration
- name: Define server configuration file and common nginx configuration
- name: Define server configuration file
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
src: 'etc/nginx/nginx.conf.j2'
dest: '/etc/nginx/nginx.conf'
owner: root
group: "{{ item.group }}"
mode: "{{ item.mode }}"
with_items:
- { src: 'etc/nginx/nginx.conf.j2', dest: '/etc/nginx/nginx.conf', group: '{{ common_web_user }}', mode: "0644" }
- { src: 'edx/app/nginx/sites-available/edx-release.j2', dest: '{{ nginx_sites_available_dir }}/edx-release', group: 'root', mode: "0600" }
group: '{{ common_web_user }}'
mode: '0644'
notify: restart nginx
tags:
- install
- install:configuration
- name: Create robot rules
template:
src: "edx/app/nginx/robots.txt.j2"
dest: "{{ nginx_app_dir }}/robots.txt"
owner: root
group: "{{ common_web_user }}"
mode: 0644
notify: reload nginx
when: NGINX_ROBOT_RULES|length > 0
tags:
- install
- install:configuration
- name: Creating link for common nginx configuration
file:
src: "{{ nginx_sites_available_dir }}/edx-release"
dest: "{{ nginx_sites_enabled_dir }}/edx-release"
state: link
owner: root
group: root
notify: reload nginx
tags:
- install
- install:configuration
- name: Copying nginx configs for {{ nginx_sites }}
template:
src: "{{ nginx_template_dir }}/{{ item }}.j2"
dest: "{{ nginx_sites_available_dir }}/{{ item }}"
owner: root
group: "{{ common_web_user }}"
mode: "0640"
with_items: "{{ nginx_sites }}"
notify: reload nginx
tags:
- install
- install:configuration
- name: Creating nginx config links for {{ nginx_sites }}
file:
src: "{{ nginx_sites_available_dir }}/{{ item }}"
dest: "{{ nginx_sites_enabled_dir }}/{{ item }}"
state: link
owner: root
group: root
with_items: "{{ nginx_sites }}"
notify: reload nginx
tags:
- install
- install:configuration
- name: Copying nginx extra configs
template:
src: "{{ item }}"
......@@ -249,52 +178,6 @@
- install
- install:configuration
# Check to see if the ssl cert/key exists before copying.
# This extra check is done to prevent failures when
# ansible-playbook is run locally
- local_action:
module: stat
path: "{{ NGINX_SSL_CERTIFICATE }}"
become: False
register: ssl_cert
tags:
- install
- install:configuration
- local_action:
module: stat
path: "{{ NGINX_SSL_KEY }}"
become: False
register: ssl_key
tags:
- install
- install:configuration
- name: copy ssl cert
copy:
src: "{{ NGINX_SSL_CERTIFICATE }}"
dest: "/etc/ssl/certs/"
owner: root
group: root
mode: 0644
when: ssl_cert.stat.exists and NGINX_ENABLE_SSL and NGINX_SSL_CERTIFICATE != 'ssl-cert-snakeoil.pem'
tags:
- install
- install:configuration
- name: copy ssl key
copy:
src: "{{ NGINX_SSL_KEY }}"
dest: "/etc/ssl/private/"
owner: root
group: root
mode: 0640
when: ssl_key.stat.exists and NGINX_ENABLE_SSL and NGINX_SSL_KEY != 'ssl-cert-snakeoil.key'
no_log: True
tags:
- install
- install:configuration
# removing default link
- name: Removing default nginx config and restart (enabled)
file:
......
server {
listen 8099 default_server;
location = /versions.html {
alias {{ nginx_cfg.version_html }};
}
location = /versions.json {
alias {{ nginx_cfg.version_json }};
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment