Separate Ansible world into setup and deployment.

This makes it possible to run a deployment as opposed to a 'setup' play
where all the necessary prerequisites are arranged on the server. We
don't need to do that each time.

Closes decentral1se/xppl#4.

Might help decentral1se/xppl#2.
This commit is contained in:
Luke Murphy 2018-12-15 00:03:27 +00:00
parent 1d044b5dbc
commit fc393a3d5f
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
4 changed files with 42 additions and 9 deletions

View File

@ -1,14 +1,27 @@
# XPPL Ansible Automation # XPPL Ansible Automation
An automated deployment for the XPPL. An automated deployment for the XPPL. If you're running these scripts, you'll
need SSH access and Sudo permissions on the machines. It is already running
deployments for:
## Run It * [books.vvvvvvaria.org](https://books.vvvvvvaria.org/)
You'll need to have SSH and Sudo access to [varia.zone] first. ## Prerequisites
You'll need to install [Ansible](https://docs.ansible.com).
```bash ```bash
$ sudo apt install -y ansible $ sudo apt install -y ansible
$ ansible-playbook --ask-become-pass plays/main.yml
``` ```
[varia.zone]: https://varia.zone/ ## Setup a New XPPL
```bash
$ ansible-playbook --limit varia-zone --ask-become-pass plays/setup.yml
```
## Deploy a New XPPL Version
```bash
$ ansible-playbook --limit varia-zone --ask-become-pass plays/deploy.yml
```

View File

@ -1,2 +1,2 @@
[varia-zone] [managed]
varia.zone ansible_ssh_port=12345 varia.zone ansible_ssh_port=12345

20
ansible/plays/deploy.yml Normal file
View File

@ -0,0 +1,20 @@
---
- hosts: managed
pre_tasks:
- name: Shutdown the running XPPL for the deployment.
become: true
supervisorctl:
name: 'xppl:'
state: stopped
roles:
- role: git # Clone the project source
- role: pipenv # Install Python dependencies
- role: env # Configure the application environment
- role: nginx # Setup the Nginx configuration
post_tasks:
- name: Start back up the XPPL after the deployment.
become: true
supervisorctl:
name: 'xppl:'
state: stopped

View File

@ -1,11 +1,11 @@
--- ---
- hosts: varia-zone - hosts: managed
roles: roles:
- role: perms # Setup users and groups - role: perms # Setup users and groups
- role: git # Clone the project source - role: git # Clone the project source
- role: pipenv # Install Python dependencies - role: pipenv # Install Python dependencies
- role: env # Configure application environment - role: env # Configure the application environment
- role: rqlite # Install RQLite - role: rqlite # Install RQLite
- role: supervisor # Setup managed processes - role: supervisor # Setup managed processes
- role: nginx # Setup Nginx configuration - role: nginx # Setup the Nginx configuration