change postgres to mariadb
This commit is contained in:
parent
6a420dee06
commit
0152e6b20c
5 changed files with 42 additions and 77 deletions
50
README.md
50
README.md
|
@ -4,8 +4,8 @@ Ansible cat
|
||||||
|
|
||||||
This repo contains the ansible role needed to deploy the [cat](https://git.zeus.gent/zeuswpi/cat) project
|
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.
|
Add the src of this repo to your requirements.yml file.
|
||||||
|
|
||||||
- src: git+https://git.zeus.gent/zeuswpi/ansible__cat
|
- 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
|
ansible-galaxy install -r requirements.yml
|
||||||
|
|
||||||
Running
|
Usage
|
||||||
-------
|
-----
|
||||||
|
|
||||||
Include the role like a normal ansible role.
|
Example of how to use the role in a playbook
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
- hosts: servers
|
- hosts: servers
|
||||||
roles:
|
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.
|
|
@ -2,12 +2,12 @@
|
||||||
# defaults file for .
|
# defaults file for .
|
||||||
cat_user: cat
|
cat_user: cat
|
||||||
|
|
||||||
cat_postgres_db: cat
|
mariadb_root_password: "some_super_secure_password"
|
||||||
cat_postgres_user: cat_user
|
|
||||||
cat_postgres_db_port: 5432
|
|
||||||
|
|
||||||
# sensitive info
|
cat_db_name: cat
|
||||||
cat_postgres_password: "{{ vault_cat_postgres_password }}"
|
cat_db_user: cat_user
|
||||||
|
cat_db_password: "efsdQEZ^$$145Dfa=ù§4"
|
||||||
|
cat_db_port: 5432
|
||||||
|
|
||||||
cat_git_destination: "/home/{{ cat_user }}/cat_src"
|
cat_git_destination: "/home/{{ cat_user }}/cat_src"
|
||||||
|
|
||||||
|
|
1
requirements.yml
Normal file
1
requirements.yml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
- src: geerlingguy.mysql
|
|
@ -15,41 +15,13 @@
|
||||||
# Database #
|
# 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: yes
|
||||||
become_user: root
|
become_user: root
|
||||||
systemd:
|
include_role:
|
||||||
enabled: yes
|
name: geerliguy.mysql
|
||||||
state: started
|
|
||||||
name: postgresql
|
|
||||||
|
|
||||||
- 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 #
|
# Download and install leiningen #
|
||||||
|
@ -73,9 +45,16 @@
|
||||||
path: "{{ user_bin_dir }}/lein"
|
path: "{{ user_bin_dir }}/lein"
|
||||||
mode: "a+x"
|
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
|
- name: Compile to jar
|
||||||
shell: lein uberjar
|
shell: lein uberjar
|
||||||
|
|
11
vars/main.yml
Normal file
11
vars/main.yml
Normal 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"
|
Loading…
Reference in a new issue