keycloak-postgresql-jdbc-driver-installed

Description

Install the PostgreSQL-jdbc driver for Keycloak (if necessary).

Variables

Name Type Default Description

keycloak_db_name

string --

The keycloak database name. Required

keycloak_db_password

string --

The keycloak postgres database password. Required

keycloak_db_user

string --

The keycloak database user. Required

keycloak_home

string /opt/keycloak

The home of the keycloak installation.

pg_jdbc_version

string 42.2.5

The version of the driver.

Code

doc:
  short_help: Install the PostgreSQL-jdbc driver for Keycloak (if necessary).
args:
  pg_jdbc_version:
    doc:
      short_help: The version of the driver.
    type: string
    default: 42.2.5
    required: false
  keycloak_home:
    doc:
      short_help: The home of the keycloak installation.
    type: string
    default: /opt/keycloak
    required: false
  keycloak_db_name:
    doc:
      short_help: The keycloak database name.
    type: string
    required: true
  keycloak_db_user:
    doc:
      short_help: The keycloak database user.
    type: string
    required: true
  keycloak_db_password:
    doc:
      short_help: The keycloak postgres database password.
    type: string
    secret: true
    required: true
frecklets:
- file-downloaded:
    url: 'https://jdbc.postgresql.org/download/postgresql-{{:: pg_jdbc_version ::}}.jar'
    dest: '/tmp/postgresql-{{:: pg_jdbc_version ::}}.jar'
    become: true
- keycloak-postgresql-helper-script-file:
    path: /tmp/postgres.config.cli
    postgresql_driver_jar: '/tmp/postgresql-{{:: pg_jdbc_version ::}}.jar'
    keycloak_db_user: '{{:: keycloak_db_user ::}}'
    keycloak_db_name: '{{:: keycloak_db_name ::}}'
    keycloak_db_password: '{{:: keycloak_db_password ::}}'
- execute-command:
    command: '{{:: keycloak_home ::}}/bin/jboss-cli.sh --file=/tmp/postgres.config.cli'
    become_user: keycloak
    ignore_error: true
    no_log: false
- path-is-absent:
    path: /tmp/postgres.config.cli
frecklecute --community keycloak-postgresql-jdbc-driver-installed --help

Usage: frecklecute keycloak-postgresql-jdbc-driver-installed 
           [OPTIONS]

  Install the PostgreSQL-jdbc driver for Keycloak (if necessary).

Options:
  --keycloak-db-name KEYCLOAK_DB_NAME
                                  The keycloak database name.  [required]
  --keycloak-db-password KEYCLOAK_DB_PASSWORD
                                  The keycloak postgres database password.
                                  [required]
  --keycloak-db-user KEYCLOAK_DB_USER
                                  The keycloak database user.  [required]
  --keycloak-home KEYCLOAK_HOME   The home of the keycloak installation.
  --pg-jdbc-version PG_JDBC_VERSION
                                  The version of the driver.
  --help                          Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.keycloak_postgresql_jdbc_driver_installed.KeycloakPostgresqlJdbcDriverInstalled
#


from dataclasses import dataclass
from pyckles import AutoPycklet
from typing import *    # noqa

@dataclass
class KeycloakPostgresqlJdbcDriverInstalled(AutoPycklet):
    """Install the PostgreSQL-jdbc driver for Keycloak (if necessary).

       Args:
         keycloak_db_name: The keycloak database name.
         keycloak_db_password: The keycloak postgres database password.
         keycloak_db_user: The keycloak database user.
         keycloak_home: The home of the keycloak installation.
         pg_jdbc_version: The version of the driver.

    """

    FRECKLET_ID = "keycloak-postgresql-jdbc-driver-installed"

    keycloak_db_name: str = None
    keycloak_db_password: str = None
    keycloak_db_user: str = None
    keycloak_home: str = None
    pg_jdbc_version: str = None


    def __post_init__(self):
        super(KeycloakPostgresqlJdbcDriverInstalled, self).__init__(var_names=["keycloak_db_name", "keycloak_db_password", "keycloak_db_user", "keycloak_home", "pg_jdbc_version"])


frecklet_class = KeycloakPostgresqlJdbcDriverInstalled
# -*- coding: utf-8 -*-


#
# module path: pycklets.keycloak_postgresql_jdbc_driver_installed.KeycloakPostgresqlJdbcDriverInstalled
#


from pyckles import AutoPycklet

class KeycloakPostgresqlJdbcDriverInstalled(AutoPycklet):
    """Install the PostgreSQL-jdbc driver for Keycloak (if necessary).

       Args:
         keycloak_db_name: The keycloak database name.
         keycloak_db_password: The keycloak postgres database password.
         keycloak_db_user: The keycloak database user.
         keycloak_home: The home of the keycloak installation.
         pg_jdbc_version: The version of the driver.

    """

    FRECKLET_ID = "keycloak-postgresql-jdbc-driver-installed"

    def __init__(self, keycloak_db_name=None, keycloak_db_password=None, keycloak_db_user=None, keycloak_home="/opt/keycloak", pg_jdbc_version="42.2.5"):

        super(KeycloakPostgresqlJdbcDriverInstalled, self).__init__(var_names=["keycloak_db_name", "keycloak_db_password", "keycloak_db_user", "keycloak_home", "pg_jdbc_version"])
        self._keycloak_db_name = keycloak_db_name
        self._keycloak_db_password = keycloak_db_password
        self._keycloak_db_user = keycloak_db_user
        self._keycloak_home = keycloak_home
        self._pg_jdbc_version = pg_jdbc_version

    @property
    def keycloak_db_name(self):
        return self._keycloak_db_name

    @keycloak_db_name.setter
    def keycloak_db_name(self, keycloak_db_name):
        self._keycloak_db_name = keycloak_db_name

    @property
    def keycloak_db_password(self):
        return self._keycloak_db_password

    @keycloak_db_password.setter
    def keycloak_db_password(self, keycloak_db_password):
        self._keycloak_db_password = keycloak_db_password

    @property
    def keycloak_db_user(self):
        return self._keycloak_db_user

    @keycloak_db_user.setter
    def keycloak_db_user(self, keycloak_db_user):
        self._keycloak_db_user = keycloak_db_user

    @property
    def keycloak_home(self):
        return self._keycloak_home

    @keycloak_home.setter
    def keycloak_home(self, keycloak_home):
        self._keycloak_home = keycloak_home

    @property
    def pg_jdbc_version(self):
        return self._pg_jdbc_version

    @pg_jdbc_version.setter
    def pg_jdbc_version(self, pg_jdbc_version):
        self._pg_jdbc_version = pg_jdbc_version



frecklet_class = KeycloakPostgresqlJdbcDriverInstalled