forked from oravirt/ansible-oracle
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ORDS: new experimental role to install and configure ORDS on OracleLinux
- Loading branch information
Showing
10 changed files
with
439 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
major_changes: | ||
- "ORDS: new experimental role to install and configure ORDS on OracleLinux (oravirt#473)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
- name: Install and Configure Oracle Rest Data Services | ||
hosts: "{{ hostgroup | default('all') }}" | ||
any_errors_fatal: true | ||
roles: | ||
- opitzconsulting.ansible_oracle.oraords |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
logging: | ||
level: warning | ||
template: readme | ||
force_overwrite: true | ||
exclude_tags: | ||
- always | ||
- never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
# oraords | ||
|
||
Install ORDS on Oracle Linux. | ||
|
||
Defaults: | ||
|
||
ORACLE_HOME: {{ oracle_base }}/product/ords | ||
|
||
This role is limited to Oracle Linux, due to installation | ||
from yum Repository from Oracle. | ||
|
||
## Table of content | ||
|
||
- [Requirements](#requirements) | ||
- [Default Variables](#default-variables) | ||
- [oraords_apex_image_path](#oraords_apex_image_path) | ||
- [oraords_db_pools](#oraords_db_pools) | ||
- [oraords_default_admin_user](#oraords_default_admin_user) | ||
- [oraords_default_port](#oraords_default_port) | ||
- [oraords_java_rpm](#oraords_java_rpm) | ||
- [oraords_oracle_home](#oraords_oracle_home) | ||
- [oraords_ords_bin](#oraords_ords_bin) | ||
- [oraords_ords_config](#oraords_ords_config) | ||
- [oraords_ords_logs](#oraords_ords_logs) | ||
- [ords_config](#ords_config) | ||
- [Discovered Tags](#discovered-tags) | ||
- [Dependencies](#dependencies) | ||
- [License](#license) | ||
- [Author](#author) | ||
|
||
--- | ||
|
||
## Requirements | ||
|
||
- Minimum Ansible version: `2.14.0` | ||
|
||
## Default Variables | ||
|
||
### oraords_apex_image_path | ||
|
||
Directory for APEX Images on ORDS Host. | ||
|
||
### oraords_db_pools | ||
|
||
List of configured target in ORDS. | ||
|
||
Attributes: | ||
|
||
db_pool: <Pool in ORDS> | ||
|
||
pdb_name: <Target PDB. Needed to find the Password s> | ||
|
||
port: <Listener Port> | ||
|
||
service: <servicename of target. Defaults to pdb_name> | ||
|
||
hostname: <Hostname for target. Defaults to `inventory_hostname`> | ||
|
||
#### Default value | ||
|
||
```YAML | ||
oraords_db_pools: | ||
- db_pool: default | ||
pdb_name: orclpdb | ||
admin_user: sys | ||
service: orclpdb | ||
port: 1521 | ||
``` | ||
### oraords_default_admin_user | ||
#### Default value | ||
```YAML | ||
oraords_default_admin_user: sys | ||
``` | ||
### oraords_default_port | ||
#### Default value | ||
```YAML | ||
oraords_default_port: 1521 | ||
``` | ||
### oraords_java_rpm | ||
#### Default value | ||
```YAML | ||
oraords_java_rpm: java-21-openjdk | ||
``` | ||
### oraords_oracle_home | ||
`ORACLE_HOME` for _ORDS_. | ||
|
||
#### Default value | ||
|
||
```YAML | ||
oraords_oracle_home: >- | ||
{{ oracle_base }}/product/ords | ||
``` | ||
|
||
### oraords_ords_bin | ||
|
||
#### Default value | ||
|
||
```YAML | ||
oraords_ords_bin: >- | ||
/usr/local/bin | ||
``` | ||
|
||
### oraords_ords_config | ||
|
||
#### Default value | ||
|
||
```YAML | ||
oraords_ords_config: >- | ||
/etc/ords/config | ||
``` | ||
|
||
### oraords_ords_logs | ||
|
||
#### Default value | ||
|
||
```YAML | ||
oraords_ords_logs: >- | ||
/etc/ords/logs | ||
``` | ||
|
||
### ords_config | ||
|
||
APEX context path for Images. | ||
|
||
## Discovered Tags | ||
|
||
**_ords_config_** | ||
|
||
|
||
## Dependencies | ||
|
||
- orahost_meta | ||
- orasw_meta | ||
|
||
## License | ||
|
||
license (MIT) | ||
|
||
## Author | ||
|
||
Thorsten Bruhns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
# @var oraords_oracle_home:description: > | ||
# `ORACLE_HOME` for _ORDS_. | ||
# @end | ||
oraords_oracle_home: >- | ||
{{ oracle_base }}/product/ords | ||
# @var ords_config:description: > | ||
# ORDS configuration directory. | ||
# @end | ||
oraords_ords_config: >- | ||
/etc/ords/config | ||
# @var ords_config:description: > | ||
# ORDS logging directory. | ||
# @end | ||
oraords_ords_logs: >- | ||
/etc/ords/logs | ||
oraords_java_rpm: java-21-openjdk | ||
|
||
# @var ords_config:description: > | ||
# PATH for ords binary | ||
# @end | ||
oraords_ords_bin: >- | ||
/usr/local/bin | ||
# oraords_apex_admin_password: | ||
|
||
# default admin_user when no user is set in oraords_db_pools | ||
oraords_default_admin_user: sys | ||
oraords_default_port: 1521 | ||
|
||
# @var oraords_apex_image_path:description: > | ||
# Directory for APEX Images on ORDS Host. | ||
# | ||
# @end | ||
# oraords_apex_image_path: | ||
|
||
# @var ords_config:description: > | ||
# APEX context path for Images. | ||
# @end | ||
# oraords_apex_image_context: | ||
|
||
# @var oraords_db_pools:description: > | ||
# List of configured target in ORDS. | ||
# | ||
# Attributes: | ||
# | ||
# db_pool: <Pool in ORDS> | ||
# | ||
# pdb_name: <Target PDB. Needed to find the Password s> | ||
# | ||
# port: <Listener Port> | ||
# | ||
# service: <servicename of target. Defaults to pdb_name> | ||
# | ||
# hostname: <Hostname for target. Defaults to `inventory_hostname`> | ||
# @end | ||
oraords_db_pools: | ||
- db_pool: default | ||
pdb_name: orclpdb | ||
admin_user: sys | ||
service: orclpdb | ||
port: 1521 | ||
# hostname: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
# @meta description: > | ||
# Install ORDS on Oracle Linux. | ||
# | ||
# Defaults: | ||
# | ||
# ORACLE_HOME: {{ oracle_base }}/product/ords | ||
# | ||
# This role is limited to Oracle Linux, due to installation | ||
# from yum Repository from Oracle. | ||
# | ||
# @end | ||
# @meta author: Thorsten Bruhns | ||
galaxy_info: | ||
role_name: oraswords_install | ||
author: Thorsten Bruhns | ||
description: Install ORDS on Oracle Linux. | ||
company: Thorsten Bruhns | ||
license: license (MIT) | ||
|
||
min_ansible_version: 2.14.0 | ||
|
||
platforms: | ||
- name: EL | ||
versions: | ||
- "7" | ||
- "8" | ||
|
||
galaxy_tags: [] | ||
|
||
dependencies: | ||
- role: orahost_meta | ||
- role: orasw_meta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
- name: assert | Assert OS | ||
ansible.builtin.assert: | ||
that: | ||
- ansible_distribution == 'OracleLinux' | ||
- ansible_distribution_major_version is version('8', '>=') | ||
fail_msg: >- | ||
Installation of ORDS is limited to Oracle Linux 8 and 9 at the moment. | ||
- name: assert | Check for existing APEX Images when oraords_apex_image_path is defined | ||
when: | ||
- oraords_apex_image_path | default('') | length > 0 | ||
block: | ||
- name: assert | Check for existing APEX Images | ||
ansible.builtin.stat: | ||
path: "{{ oraords_apex_image_path }}/css/apex.css" | ||
register: _oraords_apex_images_dir | ||
|
||
- name: assert | Assert for existing APEX Images | ||
ansible.builtin.assert: | ||
quiet: true | ||
that: | ||
- _oraords_apex_images_dir.stat.exists | ||
fail_msg: >- | ||
Missing APEX Images in {{ oraords_apex_image_path }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
- name: loop_configure_ords | Assert | ||
ansible.builtin.assert: | ||
quiet: true | ||
that: | ||
- oraords_db_pools_password[_loop_pool.db_pool]['admin_password'] is defined | ||
- oraords_db_pools_password[_loop_pool.db_pool]['ords_password'] is defined | ||
|
||
- name: loop_configure_ords | Defaults | ||
tags: | ||
- ords_config | ||
environment: | ||
ADMIN_USER: "{{ _loop_pool.admin_user | default(oraords_admin_user) }}" | ||
ADMIN_PASSWORD: "{{ oraords_db_pools_password[_loop_pool.db_pool]['admin_password'] }}" | ||
ORDS_PASSWORD: "{{ oraords_db_pools_password[_loop_pool.db_pool]['ords_password'] }}" | ||
APEX_IMAGE_PATH: "{{ oraords_apex_image_path | default('') }}" | ||
APEX_IMAGE_CONTEXT: "{{ oraords_apex_image_context | default('') }}" | ||
DB_POOL: "{{ _loop_pool.db_pool }}" | ||
block: | ||
- name: loop_configure_ords | | DB setup | ||
ansible.builtin.shell: # noqa: no-changed-when | ||
chdir: /tmp | ||
cmd: | | ||
/usr/bin/env bash | ||
set -eu | ||
set -o pipefail | ||
echo "config: {{ oraords_ords_config }}" | ||
echo "log: {{ oraords_ords_logs }}" | ||
echo "admin-user: ${ADMIN_USER}" | ||
echo "db-pool: ${DB_POOL}" | ||
echo "db-hostname: {{ _loop_pool.host }}" | ||
echo "db-port: {{ _loop_pool.port | default(oraords_default_port) }}" | ||
echo "db-servicename: {{ _loop_pool.service | mandatory }}" | ||
echo "APEX_IMAGE_PATH: ${APEX_IMAGE_PATH}" | ||
echo "APEX_IMAGE_CONTEXT: ${APEX_IMAGE_CONTEXT}" | ||
if [ ${DB_POOL} = 'default' ] ; then | ||
DB_POOL_PARAM="" | ||
else | ||
DB_POOL_PARAM="${DB_POOL}" | ||
fi | ||
{{ oraords_ords_bin }}/ords \ | ||
--config {{ oraords_ords_config }} \ | ||
--verbose \ | ||
install \ | ||
--log-folder {{ oraords_ords_logs }} \ | ||
${DB_POOL_PARAM} \ | ||
--admin-user "${ADMIN_USER}" \ | ||
--db-hostname "{{ _loop_pool.host | mandatory }}" \ | ||
--db-port {{ _loop_pool.port | default(oraords_default_port) }} \ | ||
--db-servicename {{ _loop_pool.service | mandatory }} \ | ||
--feature-db-api {{ _loop_pool.feature_db_api | default(false) | ternary('true', 'false') }} \ | ||
--feature-rest-enabled-sql {{ _loop_pool.feature_rest_enabled_sql | default(false) | ternary('true', 'false') }} \ | ||
--feature-sdw {{ _loop_pool.feature_sdw | default('false') | ternary('true', 'false') }} \ | ||
--proxy-user \ | ||
--password-stdin <<EOF | ||
${ADMIN_PASSWORD} | ||
${ORDS_PASSWORD} | ||
EOF | ||
if [ -n "${APEX_IMAGE_CONTEXT}" ] ; then | ||
echo "" | ||
echo "Change APEX Image context: ${APEX_IMAGE_CONTEXT}" | ||
{{ oraords_ords_bin }}/ords \ | ||
--config {{ oraords_ords_config }} \ | ||
config set standalone.static.context.path "${APEX_IMAGE_CONTEXT}" | ||
fi | ||
if [ -n "${APEX_IMAGE_PATH}" ] ; then | ||
echo "" | ||
echo "Change APEX Image path: ${APEX_IMAGE_PATH}" | ||
{{ oraords_ords_bin }}/ords \ | ||
--config {{ oraords_ords_config }} \ | ||
config set standalone.static.path "${APEX_IMAGE_PATH}" | ||
fi | ||
register: ords_config1_res | ||
|
||
- name: loop_configure_ords | Reload ORDS Service | ||
ansible.builtin.service: | ||
name: ords | ||
state: reloaded | ||
|
||
rescue: | ||
- name: loop_configure_ords | ORDS configuration failed | ||
ansible.builtin.fail: | ||
|
||
always: | ||
- name: loop_configure_ords | ords Output | ||
ansible.builtin.debug: | ||
var: ords_config1_res.stdout_lines | ||
when: | ||
- ords_config1_res.stdout_lines is defined |
Oops, something went wrong.