---
- name: restart postgres
service: name=postgresql state=restarted
- sudo: True
+ become: True
---
- name: install apt packages
apt: pkg={{ item }} update_cache=yes cache_valid_time=3600
- sudo: True
+ become: True
with_items:
- libpq-dev
- postgresql
copy: >
src=postgresql.conf dest=/etc/postgresql/9.3/main/postgresql.conf
owner=postgres group=postgres mode=0644
- sudo: True
+ become: True
notify: restart postgres
- name: copy client authentication configuration file
copy: >
src=pg_hba.conf dest=/etc/postgresql/9.3/main/pg_hba.conf
owner=postgres group=postgres mode=0640
- sudo: True
+ become: True
notify: restart postgres
+- name: create project locale
+ locale_gen: name={{ locale }}
+ become: True
- name: create a user
postgresql_user:
name: "{{ database_user }}"
password: "{{ db_pass }}"
- sudo: True
- sudo_user: postgres
+ become: True
+ become_user: postgres
- name: create the database
postgresql_db:
name: "{{ database_name }}"
lc_ctype: "{{ locale }}"
lc_collate: "{{ locale }}"
template: template0
- sudo: True
- sudo_user: postgres
+ become: True
+ become_user: postgres
---
- name: restart supervisor
supervisorctl: name=gunicorn_mezzanine state=restarted
- sudo: True
+ become: True
- name: restart nginx
service: name=nginx state=restarted
- sudo: True
+ become: True
template: src=gunicorn.conf.py.j2 dest={{ mezzanine_proj_path }}/gunicorn.conf.py
- name: set the supervisor config file
template: src=supervisor.conf.j2 dest=/etc/supervisor/conf.d/mezzanine.conf
- sudo: True
+ become: True
notify: restart supervisor
- name: ensure config path exists
file: path={{ mezzanine_conf_path }} state=directory
- sudo: True
+ become: True
when: tls_enabled
- name: install poll twitter cron job
cron: >
---
- name: install apt packages
apt: pkg={{ item }} update_cache=yes cache_valid_time=3600
- sudo: True
+ become: True
with_items:
- git
- libjpeg-dev
- name: set the nginx config file
template: src=nginx.conf.j2 dest=/etc/nginx/sites-available/mezzanine.conf
notify: restart nginx
- sudo: True
+ become: True
- name: enable the nginx config file
file:
src: /etc/nginx/sites-available/mezzanine.conf
dest: /etc/nginx/sites-enabled/mezzanine.conf
state: link
notify: restart nginx
- sudo: True
+ become: True
- name: remove the default nginx config file
file: path=/etc/nginx/sites-enabled/default state=absent
notify: restart nginx
- sudo: True
+ become: True
- name: create ssl certificates
command: >
openssl req -new -x509 -nodes -out {{ mezzanine_proj_name }}.crt
-keyout {{ mezzanine_proj_name }}.key -subj '/CN={{ domains[0] }}' -days 3650
chdir={{ mezzanine_conf_path }}
creates={{ mezzanine_conf_path }}/{{ mezzanine_proj_name }}.crt
- sudo: True
+ become: True
when: tls_enabled
notify: restart nginx
from __future__ import unicode_literals
import multiprocessing
-bind = "127.0.0.1:{{ mezzanine_gunicorn_port }}"
-workers = multiprocessing.cpu_count() * 2 + 1
+bind = "unix:{{ mezzanine_proj_path }}/gunicorn.sock"
+workers = {{ mezzanine_num_workers }}
+errorlog = "/home/{{ mezzanine_user }}/logs/{{ mezzanine_proj_name }}_error.log"
loglevel = "error"
proc_name = "{{ mezzanine_proj_name }}"
---
# vars file for mezzanine
mezzanine_user: "{{ ansible_user }}"
-mezzanine_venv_home: "{{ ansible_env.HOME }}"
-mezzanine_venv_path: "{{ mezzanine_venv_home }}/{{ mezzanine_proj_name }}"
-mezzanine_repo_url: git@github.com:lorin/mezzanine-example.git
-mezzanine_proj_dirname: project
-mezzanine_proj_path: "{{ mezzanine_venv_path }}/{{ mezzanine_proj_dirname }}"
+mezzanine_venv_home: "{{ ansible_env.HOME }}/.virtualenvs"
+mezzanine_venv_path: "{{ venv_home }}/{{ proj_name }}"
+mezzanine_repo_url: git@github.com:ansiblebook/mezzanine_example.git
+mezzanine_proj_path: "{{ ansible_env.HOME }}/mezzanine/{{ mwzzanine_proj_name }}"
mezzanine_reqs_path: requirements.txt
mezzanine_conf_path: /etc/nginx/conf
mezzanine_python: "{{ mezzanine_venv_path }}/bin/python"
mezzanine_manage: "{{ mezzanine_python }} {{ mezzanine_proj_path }}/manage.py"
-mezzanine_gunicorn_port: 8000
+mezzanine_num_workers: "multiprocessing.cpu_count() * 2 + 1"