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 forks=10
internal_poll_interval=0.004 internal_poll_interval=0.004
inventory=inventory inventory=inventory
retry_files=false
roles_path=roles roles_path=roles
[privilege_escalation] [privilege_escalation]
become=False become=false
become_method=sudo become_method=sudo
[ssh_connection] [ssh_connection]
pipelining=True pipelining=true

View File

@ -1,5 +1,2 @@
[dev]
localhost ansible_connection=local
[prod] [prod]
varia.zone ansible_ssh_port=12345 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 We use [Molecule] and the [Docker driver] to automate tests.
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.
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 [Molecule]: https://molecule.readthedocs.io/en/latest/
any variables that are in defaults/main.yml, vars/main.yml, and any variables [Docker driver]: https://molecule.readthedocs.io/en/latest/configuration.html#docker
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.
Dependencies # Supported OS
------------
A list of other roles hosted on Galaxy should go here, plus any details in * Debian Stretch
regards to parameters that may need to be set for other roles, or variables that
are used from other roles.
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 # Requirements
passed in as parameters) is always nice for users too:
None.
# Role Variables
None.
# Dependencies
None.
# Example Playbook
```yaml
- hosts: servers - hosts: servers
roles: roles:
- { role: xppl, x: 42 } - { role: xppl }
```
License # License
-------
BSD * GPLv3
Author Information # Author Information
------------------
An optional section for the role authors to include contact information, or a * https://git.vvvvvvaria.org/decentral1se
website (HTML is not allowed).

View File

@ -1,8 +1,77 @@
--- ---
# create /var/xppl - name: Ensure the XPPL group exists.
# clone the latest source there become: true
# get supervisord installed 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 rqlite database setup with supervisor
# get the nginx certificate in place # get the nginx certificate in place
# run the gunicorn server # run the gunicorn server
# configure the uploads directory with Syncthing
# write some documentation