Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
93 lines (80 sloc) 3.13 KB
---
- hosts: all
become: yes
tasks:
- apt: upgrade=dist update_cache=yes
- apt: pkg={{item}} state=latest
with_items:
- nginx
- supervisor
- git
- python-dev
- htop
- build-essential
- python-pip
- python-virtualenv
- postgresql
- daemontools
- ufw
- libpq-dev
- libffi-dev
- libssl-dev
- python-psycopg2
- e2fslibs-dev
- anacron
- libblas-dev
- liblapack-dev
- gfortran
- cython
#Basic service
- service: name=postgresql state=started
- service: name=supervisor state=started
- template: src=certs/progcom.njl.us.crt dest=/etc/nginx/progcom.njl.us.crt
- template: src=certs/progcom.njl.us.key dest=/etc/nginx/progcom.njl.us.key
- template: src=deployment/nginx.conf dest=/etc/nginx/sites-enabled/default
notify: restart nginx
- lineinfile: dest=/etc/postgresql/9.5/main/pg_hba.conf
line="local all all md5"
regexp="local\s+all\s+all\s+peer"
state=present backrefs=yes
notify: restart postgresql
#Repo
- file: path=/opt/progcom state=directory owner=n group=n
- git: repo=git@github.com:njl/progcom.git
dest=/opt/progcom accept_hostkey=True force=True
become: no
notify: restart progcom
#Virtualenv
- pip: virtualenv=/opt/progcom-venv
requirements=/opt/progcom/requirements.pip
notify: restart progcom
#Envdir
- file: path=/opt/progcom-envdir state=directory owner=n group=n
- synchronize: src=deploy-config/ dest=/opt/progcom-envdir/
delete=yes
become: no
notify: restart progcom
#Backup (Installed tarsnap by hand with `./configure #--prefix=/opt/tarsnap`)
- file: path=/opt/progcom-backup/db state=directory
- file: path=/opt/progcom-backup/logs state=directory
- file: path=/opt/progcom-backup-cache state=directory
- cron: name="backup" minute="0" hour="1" job="/opt/progcom/bin/backup >/dev/null 2>&1"
#Supervisor
- template: src=deployment/web-supervisor.conf dest=/etc/supervisor/conf.d/progcom.conf
- supervisorctl: name=progcom state=started
#us.pycon.org pull
- cron: name="pycon pull" minute="0,15,30,45" job="/opt/progcom/bin/pull >/dev/null 2>&1" state=absent
- cron: name="pycon update" minute="20" hour="7" weekday="1" job="/opt/progcom/bin/weekly_email >/dev/null 2>&1" state=absent
- name: Notify in slack channel
become: no
local_action:
module: slack
token: T0HUP6ZL6/B0JC6MH0E/hwrx6XAuyLSEnaq9zkUzMjag
msg: "Web app update deployed"
handlers:
- name: restart nginx
service: name=nginx state=restarted
- name: restart postgresql
service: name=postgresql state=restarted
- name: restart progcom
supervisorctl: name=progcom state=restarted
You can’t perform that action at this time.