Skip to content

Commit

Permalink
add ansible
Browse files Browse the repository at this point in the history
  • Loading branch information
arvyy committed Jul 15, 2024
1 parent f0e1091 commit 758a9ab
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
6 changes: 6 additions & 0 deletions deploy/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
= Ansible deployment of the static site

This folder contains deployment playbook. It is presumed that target uses nginx and systemd.

. Build the static site (see ../build folder)
. Invoke `ansible-playbook -i hosts deploy.yml -e content_zip_file=../build/schemeindex.zip` from this directory
21 changes: 21 additions & 0 deletions deploy/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- name: 'Deploy scheme index'
hosts: index.scheme.org
tasks:
- name: 'Upload nginx config'
template:
src: 'template/scheme_index.conf'
dest: '{{nginx_conf_d_location}}/scheme_index.conf'
- name: 'Ensure content root exists'
file:
name: '{{root_location}}'
state: 'directory'
- name: 'Upload scheme index content'
unarchive:
src: '{{content_zip_file}}'
dest: '{{root_location}}'
- name: 'Reload nginx service'
systemd_service:
name: 'nginx'
state: 'reloaded'

7 changes: 7 additions & 0 deletions deploy/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
all:
hosts:
index.scheme.org:
ansible_user: root
certs_location: /etc/letsencrypt/live/index.scheme.org/
nginx_conf_d_location: /etc/nginx/conf.d
root_location: /var/www/scheme_index
15 changes: 15 additions & 0 deletions deploy/template/scheme_index.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
server {

listen 1443 ssl;
server_name index.scheme.org;
ssl_certificate {{certs_location}}/fullchain.pem;
ssl_certificate_key {{certs_location}}/privkey.pem;

root {{root_location}};
index index.html;

location / {
try_files $uri index.html;
}

}

0 comments on commit 758a9ab

Please sign in to comment.