First steps at the Ansible role.

This commit is contained in:
Luke Murphy 2018-11-18 13:54:44 +01:00
parent 28dff36daf
commit 14df5f3875
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
4 changed files with 114 additions and 42 deletions

View File

@ -2,11 +2,12 @@
forks=10
internal_poll_interval=0.004
inventory=inventory
retry_files=false
roles_path=roles
[privilege_escalation]
become=False
become=false
become_method=sudo
[ssh_connection]
pipelining=True
pipelining=true

View File

@ -1,5 +1,2 @@
[dev]
localhost ansible_connection=local
[prod]
varia.zone ansible_ssh_port=12345

View File

@ -1,48 +1,53 @@
Role Name
=========
# xppl
A brief description of the role goes here.
A role to install the XPPL.
Requirements
------------
# Testing
Any pre-requisites that may not be covered by Ansible itself or the role should
be mentioned here. For instance, if the role uses the EC2 module, it may be a
good idea to mention in this section that the boto package is required.
We use [Molecule] and the [Docker driver] to automate tests.
Role Variables
--------------
```bash
$ curl -sSL https://get.docker.com/ | sh
$ virtualenv --python=$(which python3) .venv
$ source .venv/bin/activate
$ pip install molecule docker
$ molecule test
```
A description of the settable variables for this role should go here, including
any variables that are in defaults/main.yml, vars/main.yml, and any variables
that can/should be set via parameters to the role. Any variables that are read
from other roles and/or the global scope (ie. hostvars, group vars, etc.) should
be mentioned here as well.
[Molecule]: https://molecule.readthedocs.io/en/latest/
[Docker driver]: https://molecule.readthedocs.io/en/latest/configuration.html#docker
Dependencies
------------
# Supported OS
A list of other roles hosted on Galaxy should go here, plus any details in
regards to parameters that may need to be set for other roles, or variables that
are used from other roles.
* Debian Stretch
Example Playbook
----------------
Others may be supported. However, we only test on Debian.
Including an example of how to use your role (for instance, with variables
passed in as parameters) is always nice for users too:
# Requirements
- hosts: servers
roles:
- { role: xppl, x: 42 }
None.
License
-------
# Role Variables
BSD
None.
Author Information
------------------
# Dependencies
An optional section for the role authors to include contact information, or a
website (HTML is not allowed).
None.
# Example Playbook
```yaml
- hosts: servers
roles:
- { role: xppl }
```
# License
* GPLv3
# Author Information
* https://git.vvvvvvaria.org/decentral1se

View File

@ -1,8 +1,77 @@
---
# create /var/xppl
# clone the latest source there
# get supervisord installed
- name: Ensure the XPPL group exists.
become: true
group:
name: xppl
system: true
state: present
- name: Ensure the project user exists.
become: true
user:
name: xppl
system: true
groups: xppl
- name: Add the project user to the project group.
become: true
user:
name: xppl
groups: xppl
append: true
- name: Ensure the project root directory is created.
become: true
file:
path: /var/xppl/
state: directory
owner: xppl
group: xppl
mode: 0755
- name: Ensure the Git package is installed.
become: true
yum:
name: git
state: present
- name: Clone the latest project source.
become: true
become_user: xppl
git:
repo: https://git.vvvvvvaria.org/decentral1se/xppl.git
dest: /var/xppl/
version: master
register: git_clone_result
- name: Ensure the Make package is installed.
become: true
yum:
name: make
state: present
- name: Get RQLite installed into project directory.
make:
chdir: /var/xppl
target: install-rqlite
- name: Ensure Supervisor is installed.
become: true
yum:
name: supervisord
state: present
- name: Ensure Supervisor is running and enabled.
service:
name: supervisord
state: started
enabled: true
tags:
- molecule-notest
# get the rqlite database setup with supervisor
# get the nginx certificate in place
# run the gunicorn server
# configure the uploads directory with Syncthing
# write some documentation