Browse Source

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.
ansible-setup-and-deploy
Luke Murphy 5 years ago
parent
commit
fc393a3d5f
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 23
      ansible/README.md
  2. 2
      ansible/inventory
  3. 20
      ansible/plays/deploy.yml
  4. 6
      ansible/plays/setup.yml

23
ansible/README.md

@ -1,14 +1,27 @@
# 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
$ 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
```

2
ansible/inventory

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

20
ansible/plays/deploy.yml

@ -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

6
ansible/plays/main.yml → ansible/plays/setup.yml

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