diff --git a/ansible/README.md b/ansible/README.md index dd5b9a4..c125fa0 100644 --- a/ansible/README.md +++ b/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 +``` diff --git a/ansible/inventory b/ansible/inventory index 555b403..4f998c9 100644 --- a/ansible/inventory +++ b/ansible/inventory @@ -1,2 +1,2 @@ -[varia-zone] +[managed] varia.zone ansible_ssh_port=12345 diff --git a/ansible/plays/deploy.yml b/ansible/plays/deploy.yml new file mode 100644 index 0000000..2e6fa00 --- /dev/null +++ b/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 diff --git a/ansible/plays/main.yml b/ansible/plays/setup.yml similarity index 65% rename from ansible/plays/main.yml rename to ansible/plays/setup.yml index c5b8636..284955e 100644 --- a/ansible/plays/main.yml +++ b/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