websoft9/apps/roles/oracle/tasks/pre.yml

90 lines
2.6 KiB
YAML
Raw Normal View History

2022-07-23 11:11:12 +08:00
- pause:
prompt: |
Choice Oracle edition:
0: Oracle enterprise
1: Oracle express
private: no
Default:0
register: oracle_edition_options
2022-07-15 08:56:27 +08:00
2022-07-23 11:11:12 +08:00
- set_fact:
oracle_edition_meta:
"0": "enterprise"
"1": "express"
- set_fact:
oracle_edition: "{{oracle_edition_meta[oracle_edition_options.user_input]}}"
- block:
- pause:
prompt: |
Choice Oracle version:
2022-07-25 13:55:10 +08:00
0: Oracle 21
1: Oracle 18
2022-07-23 11:11:12 +08:00
private: no
Default:0
register: oracle_version_options
- set_fact:
oracle_version_meta:
"0": "21.3.0-xe"
"1": "18.4.0-xe"
- set_fact:
oracle_version: "{{oracle_version_meta[oracle_version_options.user_input]}}"
2022-08-01 11:27:28 +08:00
- set_fact:
2022-08-01 15:05:56 +08:00
oracle_delete_image: false
2022-08-01 11:27:28 +08:00
2022-07-23 11:11:12 +08:00
- debug:
msg: "oracle_version is {{oracle_version}}"
2022-07-23 12:09:27 +08:00
- name: Config .env and docker-compose for start containers
2022-07-23 11:11:12 +08:00
shell: |
sed -i 's/APP_VERSION=.*/APP_VERSION={{oracle_version}}/g' {{installpath}}/{{appname}}/.env
2022-07-25 16:26:40 +08:00
cat {{installpath}}/{{appname}}/docker-compose.yml |yq eval 'del(.services.oracleex.profiles)' > /tmp/tmp.yml
2022-07-25 17:13:16 +08:00
cat /tmp/tmp.yml > {{installpath}}/{{appname}}/docker-compose.yml
2022-07-23 11:11:12 +08:00
when: oracle_edition == "express"
- block:
- pause:
prompt: |
Choice Oracle version:
2022-07-25 13:55:10 +08:00
0: Oracle 21
1: Oracle 19
2: Oracle 12
2022-07-23 11:11:12 +08:00
private: no
Default:0
register: oracle_version_options
- set_fact:
oracle_version_meta:
"0": "21.3.0.0"
"1": "19.3.0.0"
"2": "12.2.0.1"
- set_fact:
oracle_version: "{{oracle_version_meta[oracle_version_options.user_input]}}"
2022-08-01 11:12:56 +08:00
2022-07-23 11:11:12 +08:00
- debug:
msg: "oracle_version is {{oracle_version}}"
2022-07-23 11:36:24 +08:00
2022-07-23 12:09:27 +08:00
- name: Config .env and docker-compose for start containers
2022-07-23 11:11:12 +08:00
shell: |
2022-08-02 14:17:31 +08:00
sed -i 's/APP_COMPOSE_UP=.*/APP_COMPOSE_UP=false/g' {{installpath}}/{{appname}}/.env
2022-07-23 11:11:12 +08:00
sed -i 's/APP_VERSION=.*/APP_VERSION={{oracle_version}}/g' {{installpath}}/{{appname}}/.env
2022-08-01 15:34:50 +08:00
cat {{installpath}}/{{appname}}/docker-compose.yml |yq eval 'del(.services.oracle.profiles)' > /tmp/tmp.yml
2022-07-25 17:13:16 +08:00
cat /tmp/tmp.yml > {{installpath}}/{{appname}}/docker-compose.yml
2022-08-01 14:55:50 +08:00
- name: Copy login.exp file
copy:
src: login.exp
dest: /tmp/login.exp
- name: Pull the image of enterprise
shell: |
expect /tmp/login.exp
docker pull container-registry.oracle.com/database/enterprise:"{{oracle_version}}"
rm -f /tmp/login.exp
2022-07-23 11:11:12 +08:00
when: oracle_edition == "enterprise"