Commit c0f89f72 by Sef Kloninger

Merge pull request #253 from edx/sef/nginx-long-sites-modes

nginx configuration for long site names
parents f71c1883 56a6f024
# we never want to migrate from these machines, so note no vars_prompt
# section like other appservers
# set up the fireball transport
#- hosts: ~tag_Name_app(10|20)_cme
# gather_facts: no
# connection: ssh # or paramiko
# sudo: yes
# tasks:
# - apt: pkg=gcc state=present
# - apt: pkg=libzmq-dev,python-zmq state=present
# - action: fireball
# this gets all running prod webservers
#- hosts: tag_environment_prod:&tag_function_webserver
# or we can get subsets of them by name
- hosts: ~tag_Name_app(10|20)_carn
sudo: True
vars_prompt:
......@@ -24,7 +12,8 @@
secure_dir: '../../../edx-secret/ansible'
# this indicates the path to site-specific (with precedence)
# things like nginx template files
local_dir: '../../../../../../edx-secret/ansible/local'
#local_dir: '../../../edx-secret/ansible/local'
local_dir: "{{secure_dir}}/local"
not_prod: true
vars_files:
- "{{ secure_dir }}/vars/edxapp_carnegie_vars.yml"
......@@ -32,7 +21,7 @@
- "{{ secure_dir }}/vars/edxapp_prod_users.yml"
roles:
- common
- nginx
- {'role': 'edxapp', 'openid_workaround': true}
- {'role': 'nginx', 'nginx_conf': true}
- {'role': 'edxapp', 'openid_workaround': true, 'template_subdir': 'carnegie'}
# run this role last
# - in_production
......@@ -8,7 +8,7 @@ hash_behaviour=merge
# These are environment-specific defaults
forks=10
#forks=1
log_path=stage-edx-ansible.log
log_path=~/stage-edx-ansible.log
transport=ssh
hostfile=./ec2.py
extra_vars='key=deployment name=edx-stage group=edx-stage region=us-west-1'
......@@ -16,6 +16,5 @@ user=ubuntu
[ssh_connection]
# example from https://github.com/ansible/ansible/blob/devel/examples/ansible.cfg
#ssh_args=-o ControlMaster=auto -o ControlPersist=60s -o ControlPath=/tmp/ansible-ssh-%h-%p-%r
ssh_args=-F stage-ssh-config -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=/tmp/ansible-ssh-%h-%p-%r
scp_if_ssh=True
......@@ -8,6 +8,14 @@
- nginx
- install
- name: nginx | Server configuration file
copy: src={{secure_dir}}/files/nginx.conf dest=/etc/nginx/nginx.conf owner=root group=root mode=0644
when: nginx_conf is defined
notify: nginx | restart nginx
tags:
- nginx
- install
# Standard configuration that is common across all roles
# Default values for these variables are set in group_vars/all
# Note: remove spaces in {{..}}, otherwise you will get a template parsing error.
......
# Requires nginx package
---
- name: nginx | Copying nginx config {{ site_name }}
template: src={{ item }} dest=/etc/nginx/sites-available/{{ site_name }}
template: src={{ item }} dest=/etc/nginx/sites-available/{{ site_name }} owner=root group=root mode=0600
first_available_file:
- "{{ local_dir }}/nginx/templates/{{ template_subdir }}/{{ site_name }}.j2"
- "{{ local_dir }}/nginx/templates/{{ site_name }}.j2"
# seems like paths in first_available_file must be relative to the playbooks dir
- "roles/nginx/templates/{{ site_name }}.j2"
......
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