Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Add maria/mysql support
Browse files Browse the repository at this point in the history
Does not install maria or mysql, but will work if it is already
installed.

re #4517
  • Loading branch information
asmacdo committed Mar 19, 2019
1 parent 47437db commit f1b4c52
Show file tree
Hide file tree
Showing 16 changed files with 93 additions and 96 deletions.
2 changes: 1 addition & 1 deletion example-source/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- hosts: all
roles:
- pulp3-postgresql
- pulp3-database
- pulp3-workers
- pulp3-resource-manager
- pulp3-webserver
Expand Down
2 changes: 1 addition & 1 deletion example-use/playbook.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- hosts: all
roles:
- pulp3-postgresql
- pulp3-database
- pulp3-workers
- pulp3-resource-manager
- pulp3-webserver
Expand Down
45 changes: 45 additions & 0 deletions roles/pulp3-database/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
pulp3-database
================

Optionally install a database, then configure for Pulp.

More specifically, this role does the following:

1. Call the external role to install a database if `pulp_install_db` is true.
2. Install the Python bindings to interact with the specified database.
3. Create and run migrations.

Role Variables:
---------------

* `pulp_database_config`: Defines how Pulp will talk to PostgreSQL. Default values are constructed
* from the other variables defined here. See `defaults/main.yml`.
* `pulp_db_host`: Host of the database instance. Defaults to localhost.
* `pulp_db_name`: Name of the database, defaults to pulp.
* `pulp_db_user`: Database user, should match linux user. Defaults to pulp
* `pulp_db_password`: Password for Postgresql user. Defaults to pulp
* `pulp_db_backend`: Django setting for db backend. for databasePassword for Postgresql user.
Defaults to "django.db.backends.postgresql_psycopg2"
* `pulp_install_db`: Defaults to true. Whether to install a database.

Shared Variables:
-----------------

* `ansible_python_interpreter`: **Required**. Path to the Python interpreter.

This role **is tightly coupled** with the required the `pulp3` role and uses some of
variables which are documented in that role:

* `pulp_user`
* `pulp_install_dir`
* `pulp_install_plugins`
* `pulp_default_admin_password`


This role optionally depends on other roles to install a database.

Operating Systems Variables:
----------------------------

Each currently supported operating system has a matching file in the "vars"
directory.
14 changes: 14 additions & 0 deletions roles/pulp3-database/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
pulp_install_db: true
pulp_db_host: localhost
pulp_db_name: pulp
pulp_db_user: pulp
pulp_db_password: pulp
pulp_db_backend: django.db.backends.postgresql_psycopg2
pulp_database_config:
default:
HOST: "{{ pulp_db_host }}"
ENGINE: "{{ pulp_db_backend }}"
NAME: "{{ pulp_db_name}}"
USER: "{{ pulp_db_user }}"
PASSWORD: "{{ pulp_db_password }}"
File renamed without changes.
3 changes: 3 additions & 0 deletions roles/pulp3-database/tasks/install_mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
- fail:
msg: "MySQL/Maria installation is not implented. Please install manually and set pulp_install_database to false."
19 changes: 19 additions & 0 deletions roles/pulp3-database/tasks/install_postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
- block:
- name: Install SCL package
package:
name: 'centos-release-scl'
state: present
when: ansible_distribution == 'CentOS'

- name: Set listen addresses
set_fact:
postgresql_global_config_options:
- option: listen_addresses
value: "*"
when: pulp_db_host != 'localhost'

- name: Install and configure PostgreSQL
import_role:
name: geerlingguy.postgresql
become: yes
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,15 @@
tags:
- always

- block:

- name: Install SCL package
package:
name: 'centos-release-scl'
state: present
when: ansible_distribution == 'CentOS'

- name: Set listen addresses
set_fact:
postgresql_global_config_options:
- option: listen_addresses
value: "*"
when: pulp_postgresql_host != 'localhost'

- name: Install and configure PostgreSQL
import_role:
name: geerlingguy.postgresql


become: true
when: pulp_install_postgresql
- import_tasks: install_postgres.yml
when:
- pulp_install_db
- pulp_db_type == 'postgres'

- import_tasks: install_mysql.yml
when:
- pulp_install_db
- pulp_db_type == 'mysql'

- meta: flush_handlers

Expand Down
File renamed without changes.
58 changes: 0 additions & 58 deletions roles/pulp3-postgresql/README.md

This file was deleted.

13 changes: 0 additions & 13 deletions roles/pulp3-postgresql/defaults/main.yml

This file was deleted.

2 changes: 1 addition & 1 deletion roles/pulp3/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
state: present
virtualenv: '{{ pulp_install_dir }}'
virtualenv_command: '{{ pulp_python_interpreter }} -m venv'
when: pulp_db_type == "mysql"
when: pulp_db_type == "mariadb"

- name: Install pulpcore package from source
pip:
Expand Down

0 comments on commit f1b4c52

Please sign in to comment.