Configure an external datasource

Configure an external datasource

You can enable the Runbooks automation service to use an external datasource through the Salt metadata. This section explains how to configure the service to use the PostgreSQL database as an external source for the datastore.

To enable the PostgreSQL database support:

  1. Define the following parameters on the cluster level of your Reclass model in the oss/client.yml file:

    parameters:
      _param:
        rundeck_postgresql_username: rundeck
        rundeck_postgresql_password: password
        rundeck_postgresql_database: rundeck
        rundeck_postgresql_host: ${_param:control_vip_address}
        rundeck_postgresql_port: 5432
      rundeck:
        server:
          datasource:
            engine: postgresql
            host: ${_param:rundeck_postgresql_host}
            port: ${_param:rundeck_postgresql_port}
            username: ${_param:rundeck_postgresql_username}
            password: ${_param:rundeck_postgresql_password}
            database: ${_param:rundeck_postgresql_database}
    
  2. Recreate Rundeck and PostgreSQL stacks:

    docker stack rm postgresql rundeck
    salt -C 'I@rundeck:server' state.sls rundeck.server
    salt -C 'I@docker:swarm:role:master' state.sls docker.client
    salt -C 'I@postgresql:client' state.sls postgresql.client
    salt -C 'I@rundeck:client' state.sls rundeck.client
    
  3. Verify that the Rundeck tables exist in PostgreSQL by logging as a Rundeck user in to PostgreSQL from the monitoring node where the OSS services are running and checking the log output for the base_report table. For example:

    psql -h <postgresql_ip> -U rundeck -W password
    rundeck=> \d
                  List of relations
     Schema |            Name            |   Type   |  Owner
    --------+----------------------------+----------+---------
     public | auth_token                 | table    | rundeck
     public | base_report                | table    | rundeck
     public | execution                  | table    | rundeck
     public | hibernate_sequence         | sequence | rundeck
     public | log_file_storage_request   | table    | rundeck
     public | node_filter                | table    | rundeck
     public | notification               | table    | rundeck
     public | orchestrator               | table    | rundeck
     public | plugin_meta                | table    | rundeck
     public | project                    | table    | rundeck
     public | rdoption                   | table    | rundeck
     public | rdoption_values            | table    | rundeck
     public | rduser                     | table    | rundeck
     public | report_filter              | table    | rundeck
     public | scheduled_execution        | table    | rundeck
     public | scheduled_execution_filter | table    | rundeck
     public | storage                    | table    | rundeck
     public | workflow                   | table    | rundeck
     public | workflow_step              | table    | rundeck
     public | workflow_workflow_step     | table    | rundeck
    (20 rows)
    
    rundeck=> select * from base_report;