Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
66 lines (57 sloc) 2.2 KB
# Goal: do the root-related basic provisioning for a site (now: only this
# server). A buildout user is set up with ssh keys so that the relevant devs
# can ssh in as user buildout, which will be used by the deploy.yml script.
---
- name: provision server to prepare for the actual deployment
hosts: web
become: yes
tasks:
- name: Add user "buildout" and set an unusable password
user: name=buildout password='*' state=present shell="/bin/bash"
- name: "Add maintainers' ssh keys so they can log in as user buildout."
authorized_key: user=buildout key=https://github.com/{% raw %}{{ item}}{% endraw %}.keys
with_items:
- reinout
- TODO
- name: Install various packages
apt: name={% raw %}{{item}}{% endraw %} state=latest
with_items:
- wget
- build-essential
- git
- libevent-dev
- libfreetype6-dev
- libgeos-dev
- libpng12-dev
- python3-dev
- python3-pip
- python3-psycopg2
- libssl-dev
- supervisor
- nginx
- name: Create dir inside /srv for the checkout
file:
path: /srv/{% raw %}{{ site_name }}{% endraw %}
state: directory
mode: 0755
owner: buildout
group: buildout
- name: "Look if nginx config already exists (you'll need to run deploy first!)"
stat: path=/srv/{% raw %}{{ site_name }}/etc/{{ site_name }}{% endraw %}.nginx.conf
register: nginx_conffile
- name: Symlink nginx config, when available
file:
src: /srv/{% raw %}{{ site_name }}/etc/{{ site_name }}{% endraw %}.nginx.conf
dest: /etc/nginx/sites-available/{% raw %}{{ site_name }}{% endraw %}.nginx.conf
state: link
when: nginx_conffile.stat.exists
- name: Enable nginx config, when available
file:
src: /etc/nginx/sites-available/{% raw %}{{ site_name }}{% endraw %}.nginx.conf
dest: /etc/nginx/sites-enabled/{% raw %}{{ site_name }}{% endraw %}.nginx.conf
state: link
when: nginx_conffile.stat.exists
- name: Restart nginx
service: name=nginx state=reloaded
when: nginx_conffile.stat.exists
# Perhaps some safety check that the config is OK?