change postgres to mariadb

This commit is contained in:
flynn 2019-01-29 23:18:25 +01:00
parent 6a420dee06
commit 0152e6b20c
5 changed files with 42 additions and 77 deletions

View file

@ -4,8 +4,8 @@ Ansible cat
This repo contains the ansible role needed to deploy the [cat](https://git.zeus.gent/zeuswpi/cat) project
Usage
------
Downloading
-----------
Add the src of this repo to your requirements.yml file.
- src: git+https://git.zeus.gent/zeuswpi/ansible__cat
@ -14,47 +14,21 @@ Then use following command to install the role
ansible-galaxy install -r requirements.yml
Running
-------
Usage
-----
Include the role like a normal ansible role.
The server will run on port 3000 by default.
How ansible works
=================
Requirements
------------
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.
Role Variables
--------------
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.
Dependencies
------------
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.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
Example of how to use the role in a playbook
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
- role: ansible_cat
vars:
mariadb_root_password: *****
cat_db_password: *****
License
-------
There are 2 required parameters, the mariadb root password and the cat database password.
BSD
Author Information
------------------
The server will run on port 3000 by default.
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
Other customizable parameters are listed in the defaults folder of the role.

View file

@ -2,12 +2,12 @@
# defaults file for .
cat_user: cat
cat_postgres_db: cat
cat_postgres_user: cat_user
cat_postgres_db_port: 5432
mariadb_root_password: "some_super_secure_password"
# sensitive info
cat_postgres_password: "{{ vault_cat_postgres_password }}"
cat_db_name: cat
cat_db_user: cat_user
cat_db_password: "efsdQEZ^$$145Dfa=ù§4"
cat_db_port: 5432
cat_git_destination: "/home/{{ cat_user }}/cat_src"

1
requirements.yml Normal file
View file

@ -0,0 +1 @@
- src: geerlingguy.mysql

View file

@ -15,41 +15,13 @@
# Database #
############
- name: Install psql
apt:
name: "{{ packages }}"
vars:
packages:
- python-psycopg2
- postgresql-9.6
- name: Enable postgres
- name: Ensure mariadb installation and setup database (see default vars)
become: yes
become_user: root
systemd:
enabled: yes
state: started
name: postgresql
include_role:
name: geerliguy.mysql
- name: Create database
become: yes
become_user: postgres
postgresql_db:
name: "{{ cat_postgres_db }}"
- name: Create database user
become: yes
become_user: postgres
postgresql_user:
db: "{{ cat_postgres_db }}"
name: "{{ cat_postgres_user }}"
password: "{{ cat_postgres_password }}"
- name: Clone cat repo
git:
repo: ssh://git@git.zeus.gent:2222/ZeusWPI/cat.git
dest: "{{ cat_git_destination }}"
accept_hostkey: yes
##################################
# Download and install leiningen #
@ -73,9 +45,16 @@
path: "{{ user_bin_dir }}/lein"
mode: "a+x"
###################
# Compile and run #
###################
########################
# Download and compile #
########################
- name: Clone cat repo
git:
repo: ssh://git@git.zeus.gent:2222/ZeusWPI/cat.git
dest: "{{ cat_git_destination }}"
accept_hostkey: yes
- name: Compile to jar
shell: lein uberjar

11
vars/main.yml Normal file
View file

@ -0,0 +1,11 @@
---
mysql_root_password: "{{mariadb_root_password}}"
mysql_databases:
- name: "{{cat_db_name}}"
encoding: latin1
collation: latin1_general_ci
mysql_users:
- name: "{{cat_db_user}}"
host: "%"
password: "{{cat_db_password}}"
priv: "{{cat_db_name}}.*:ALL"