From 3ba31fffc6da12c002ef07d16e4291255c9925eb Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Wed, 8 Sep 2021 04:28:58 +0000 Subject: [PATCH 1/7] orasw-meta: moved variables from oraswdb-install to orasw-meta Moving some variables into the meta role to reduce duplicate deffinitions in defaults/main.yml. --- roles/orasw-meta/defaults/main.yml | 13 +++++++++++++ roles/oraswdb-install/defaults/main.yml | 12 ------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/roles/orasw-meta/defaults/main.yml b/roles/orasw-meta/defaults/main.yml index ce6c19fda..0a20b8c6d 100644 --- a/roles/orasw-meta/defaults/main.yml +++ b/roles/orasw-meta/defaults/main.yml @@ -1,3 +1,16 @@ +--- +oracle_user: oracle # User that will own the Oracle Installations. +grid_user: grid +grid_install_user: "{% if role_separation %}{{ grid_user }}{% else %}{{ oracle_user }}{% endif %}" +oracle_user_home: "/home/{{ oracle_user }}" # Home directory for oracle_user. Needed for passing in ssh-keys, profiles etc +grid_user_home: "/home/{{ grid_install_user }}" # Home directory for oracle_user. Needed for passing in ssh-keys, profiles etc +oracle_group: oinstall # Primary group for oracle_user. +oper_group: oper +dba_group: dba # Primary group for oracle_user. +asmoper_group: asmoper +asmdba_group: asmdba # Primary group for oracle_user. +asmadmin_group: asmadmin # Primary group for oracle_user. + db_homes_config: 18300-base: home: db1-base diff --git a/roles/oraswdb-install/defaults/main.yml b/roles/oraswdb-install/defaults/main.yml index 3c708f091..9699c197c 100644 --- a/roles/oraswdb-install/defaults/main.yml +++ b/roles/oraswdb-install/defaults/main.yml @@ -1,17 +1,5 @@ #master_node: true - oracle_user: oracle # User that will own the Oracle Installations. - grid_user: grid - grid_install_user: "{% if role_separation %}{{ grid_user }}{% else %}{{ oracle_user }}{% endif %}" - oracle_user_home: "/home/{{ oracle_user }}" # Home directory for oracle_user. Needed for passing in ssh-keys, profiles etc - grid_user_home: "/home/{{ grid_install_user }}" # Home directory for oracle_user. Needed for passing in ssh-keys, profiles etc - oracle_group: oinstall # Primary group for oracle_user. - oper_group: oper - dba_group: dba # Primary group for oracle_user. - asmoper_group: asmoper - asmdba_group: asmdba # Primary group for oracle_user. - asmadmin_group: asmadmin # Primary group for oracle_user. - hostgroup: "{{ group_names[0] }}" hostgroup_hub: "{{ hostgroup }}-hub" hostgroup_leaf: "{{ hostgroup }}-leaf" From 7cf5218ca9e64298f152c747c2816d0d2f9d7afe Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Thu, 9 Sep 2021 05:07:44 +0000 Subject: [PATCH 2/7] added ansible-lint configuration This is a trial for ansible-lint in ansible-oracle. --- .ansible-lint | 5 +++++ .yamllint | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 .ansible-lint create mode 100644 .yamllint diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 000000000..f76c0bff7 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,5 @@ +use_default_rules: true + +skip_list: + - role-name + - meta-no-info diff --git a/.yamllint b/.yamllint new file mode 100644 index 000000000..d70a98a7a --- /dev/null +++ b/.yamllint @@ -0,0 +1,4 @@ +extends: default + +rules: + line-length: disable From 22c8c59e4ceb2c9d46cb4b1cdc7ed10acdd945d4 Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Thu, 9 Sep 2021 06:00:52 +0000 Subject: [PATCH 3/7] oraswdb-golden-image: ansible-lint --- roles/orasw-meta/defaults/main.yml | 180 ++++++++++++++++------ roles/oraswdb-golden-image/meta/main.yml | 3 +- roles/oraswdb-golden-image/tasks/main.yml | 67 ++++---- 3 files changed, 170 insertions(+), 80 deletions(-) diff --git a/roles/orasw-meta/defaults/main.yml b/roles/orasw-meta/defaults/main.yml index 0a20b8c6d..e05385b8d 100644 --- a/roles/orasw-meta/defaults/main.yml +++ b/roles/orasw-meta/defaults/main.yml @@ -2,13 +2,13 @@ oracle_user: oracle # User that will own the Oracle Installations. grid_user: grid grid_install_user: "{% if role_separation %}{{ grid_user }}{% else %}{{ oracle_user }}{% endif %}" -oracle_user_home: "/home/{{ oracle_user }}" # Home directory for oracle_user. Needed for passing in ssh-keys, profiles etc -grid_user_home: "/home/{{ grid_install_user }}" # Home directory for oracle_user. Needed for passing in ssh-keys, profiles etc -oracle_group: oinstall # Primary group for oracle_user. +oracle_user_home: "/home/{{ oracle_user }}" # Home directory for oracle_user. Needed for passing in ssh-keys, profiles etc +grid_user_home: "/home/{{ grid_install_user }}" # Home directory for oracle_user. Needed for passing in ssh-keys, profiles etc +oracle_group: oinstall # Primary group for oracle_user. oper_group: oper -dba_group: dba # Primary group for oracle_user. +dba_group: dba # Primary group for oracle_user. asmoper_group: asmoper -asmdba_group: asmdba # Primary group for oracle_user. +asmdba_group: asmdba # Primary group for oracle_user. asmadmin_group: asmadmin # Primary group for oracle_user. db_homes_config: @@ -26,56 +26,142 @@ db_homes_config: edition: EE opatch_minversion: 12.2.0.1.12 opatchauto: - - patchid: 28183653 - patchversion: 12.2.0.1.180717 - state: present - subpatches: - - 28163133 - - 28163190 + - patchid: 28183653 + patchversion: 12.2.0.1.180717 + state: present + subpatches: + - 28163133 + - 28163190 opatch: [] db_homes_installed: - - home: 18300-base - apply_patches: False - state: present - - home: 12201-base - apply_patches: False - state: absent - - home: 12201-180717 - apply_patches: True - state: absent + - home: 18300-base + apply_patches: false + state: present + - home: 12201-base + apply_patches: false + state: absent + - home: 12201-180717 + apply_patches: true + state: absent oracle_sw_patches: - - { filename: p28183653_122010_Linux-x86-64.zip, patchid: 28183653, version: 12.2.0.1, patchversion: 12.2.0.1.180717, description: GI-RU-July-2018, creates: 28183653/28163133/files/suptools/orachk.zip } - - { filename: p27468969_122010_Linux-x86-64.zip, patchid: 27468969, version: 12.2.0.1, patchversion: 12.2.0.1.180417, description: GI-RU-April-2018, creates: 27468969/27674384/README.txt } - - { filename: p28140658_12201180417DBAPR2018RU_Linux-x86-64.zip, patchid: 28140658, version: 12.2.0.1, patchversion: 12201180417DBAPR2018RU , description: 'PARALLEL QUERY Patch for Bug# 28140658 for Linux-x86-64 Platforms', creates: online/files/hpatch/bug28140658.pch } - - { filename: p27967747_121020_Linux-x86-64.zip, patchid: 27967747, version: 12.1.0.2, patchversion: 12.1.0.2.180717, description: GI-PSU-Jul-2018, creates: 27967747/27762277/etc/xml/ShiphomeDirectoryStructure.xml } - - { filename: p27468957_121020_Linux-x86-64.zip, patchid: 27468957, version: 12.1.0.2, patchversion: 12.1.0.2.180417, description: GI-PSU-Apr-2018, creates: 27468957/27338013/etc/config/inventory.xml } - - { filename: p19392646_121020_Linux-x86-64.zip, patchid: 19392646, version: 12.1.0.2, patchversion: 12.1.0.2.1, description: GI-PSU-Oct-2014 } - - { filename: p20485724_121020_Linux-x86-64.zip, patchid: 20485724, version: 12.1.0.2, patchversion: 12.1.0.2.3, description: GI-PSU-Apr-2015 } - - { filename: p21523234_121020_Linux-x86-64.zip, patchid: 21523234, version: 12.1.0.2, patchversion: 12.1.0.2.5, description: GI-PSU-Oct-2015 } - - { filename: p24412235_121020_Linux-x86-64.zip, patchid: 24412235, version: 12.1.0.2, patchversion: 12.1.0.2.161018, description: GI-PSU-Oct-2016 } - - { filename: p24968615_121020_Linux-x86-64.zip, patchid: 24968615, version: 12.1.0.2, patchversion: 12.1.0.2.170117, description: GI-PSU-Jan-2017} - - { filename: p25434003_121020_Linux-x86-64.zip, patchid: 25434003, version: 12.1.0.2, patchversion: 12.1.0.2.170418, description: GI-PSU-Apr-2017} - - { filename: p27967757_112040_Linux-x86-64.zip, patchid: 27967757, version: 11.2.0.4, patchversion: 11.2.0.4.180717, description: GI-PSU-Jul-2018, creates: 27967757/27959254/files/lib/acfstoolsdriver.sh } - - { filename: p27475913_112040_Linux-x86-64.zip, patchid: 27475913, version: 11.2.0.4, patchversion: 11.2.0.4.180417, description: GI-PSU-Apr-2018, creates: 27475913/22502505/files/lib/acfstoolsdriver.sh } - - { filename: p25078431_11204160419forACFS_Linux-x86-64.zip, patchid: 25078431, version: 11.2.0.4, patchversion: 11.2.0.4.160419, description: '11.2.0.4.160419 for ACFS' } - - { filename: p19380115_112040_Linux-x86-64.zip, patchid: 19380115, version: 11.2.0.4, patchversion: 11.2.0.4.4, description: GI-PSU-Apr-2018 } - - { filename: p19380115_112040_Linux-x86-64.zip, patchid: 19380115, version: 11.2.0.4, patchversion: 11.2.0.4.4, description: GI-PSU-Oct-2014 } - - { filename: p20485808_112040_Linux-x86-64.zip, patchid: 20485808, version: 11.2.0.4, patchversion: 11.2.0.4.6, description: GI-PSU-Apr-2015 } - - { filename: p21523375_112040_Linux-x86-64.zip, patchid: 21523375, version: 11.2.0.4, patchversion: 11.2.0.4.8, description: GI-PSU-Oct-2015 } + - filename: p28183653_122010_Linux-x86-64.zip + patchid: 28183653 + version: 12.2.0.1 + patchversion: 12.2.0.1.180717 + description: GI-RU-July-2018 + creates: 28183653/28163133/files/suptools/orachk.zip + - filename: p27468969_122010_Linux-x86-64.zip + patchid: 27468969 + version: 12.2.0.1 + patchversion: 12.2.0.1.180417 + description: GI-RU-April-2018 + creates: 27468969/27674384/README.txt + - filename: p28140658_12201180417DBAPR2018RU_Linux-x86-64.zip + patchid: 28140658 + version: 12.2.0.1 + patchversion: 12201180417DBAPR2018RU + description: 'PARALLEL QUERY Patch for Bug# 28140658 for Linux-x86-64 Platforms' + creates: online/files/hpatch/bug28140658.pch + - filename: p27967747_121020_Linux-x86-64.zip + patchid: 27967747 + version: 12.1.0.2 + patchversion: 12.1.0.2.180717 + description: GI-PSU-Jul-2018 + creates: 27967747/27762277/etc/xml/ShiphomeDirectoryStructure.xml + - filename: p27468957_121020_Linux-x86-64.zip + patchid: 27468957 + version: 12.1.0.2 + patchversion: 12.1.0.2.180417 + description: GI-PSU-Apr-2018 + creates: 27468957/27338013/etc/config/inventory.xml + - filename: p19392646_121020_Linux-x86-64.zip + patchid: 19392646 + version: 12.1.0.2 + patchversion: 12.1.0.2.1 + description: GI-PSU-Oct-2014 + - filename: p20485724_121020_Linux-x86-64.zip + patchid: 20485724 + version: 12.1.0.2 + patchversion: 12.1.0.2.3 + description: GI-PSU-Apr-2015 + - filename: p21523234_121020_Linux-x86-64.zip + patchid: 21523234 + version: 12.1.0.2 + patchversion: 12.1.0.2.5 + description: GI-PSU-Oct-2015 + - filename: p24412235_121020_Linux-x86-64.zip + patchid: 24412235 + version: 12.1.0.2 + patchversion: 12.1.0.2.161018 + description: GI-PSU-Oct-2016 + - filename: p24968615_121020_Linux-x86-64.zip + patchid: 24968615 + version: 12.1.0.2 + patchversion: 12.1.0.2.170117 + description: GI-PSU-Jan-2017 + - filename: p25434003_121020_Linux-x86-64.zip + patchid: 25434003 + version: 12.1.0.2 + patchversion: 12.1.0.2.170418 + description: GI-PSU-Apr-2017 + - filename: p27967757_112040_Linux-x86-64.zip + patchid: 27967757 + version: 11.2.0.4 + patchversion: 11.2.0.4.180717 + description: GI-PSU-Jul-2018 + creates: 27967757/27959254/files/lib/acfstoolsdriver.sh + - filename: p27475913_112040_Linux-x86-64.zip + patchid: 27475913 + version: 11.2.0.4 + patchversion: 11.2.0.4.180417 + description: GI-PSU-Apr-2018 + creates: 27475913/22502505/files/lib/acfstoolsdriver.sh + - filename: p25078431_11204160419forACFS_Linux-x86-64.zip + patchid: 25078431 + version: 11.2.0.4 + patchversion: 11.2.0.4.160419 + description: '11.2.0.4.160419 for ACFS' + - filename: p19380115_112040_Linux-x86-64.zip + patchid: 19380115 + version: 11.2.0.4 + patchversion: 11.2.0.4.4 + description: GI-PSU-Apr-2018 + - filename: p19380115_112040_Linux-x86-64.zip + patchid: 19380115 + version: 11.2.0.4 + patchversion: 11.2.0.4.4 + description: GI-PSU-Oct-2014 + - filename: p20485808_112040_Linux-x86-64.zip + patchid: 20485808 + version: 11.2.0.4 + patchversion: 11.2.0.4.6 + description: GI-PSU-Apr-2015 + - filename: p21523375_112040_Linux-x86-64.zip + patchid: 21523375 + version: 11.2.0.4 + patchversion: 11.2.0.4.8 + description: GI-PSU-Oct-2015 oracle_opatch_patch: - - { filename: p6880880_190000_Linux-x86-64.zip, version: 19.3.0.0 } - - { filename: p6880880_180000_Linux-x86-64.zip, version: 18.3.0.0 } - - { filename: p6880880_122010_Linux-x86-64.zip, version: 12.2.0.1 } - - { filename: p6880880_122010_Linux-x86-64.zip, version: 12.1.0.2 } - - { filename: p6880880_121010_Linux-x86-64.zip, version: 12.1.0.1 } - - { filename: p6880880_112000_Linux-x86-64.zip, version: 11.2.0.4 } - - { filename: p6880880_112000_Linux-x86-64.zip, version: 11.2.0.3 } + - filename: p6880880_190000_Linux-x86-64.zip + version: 19.3.0.0 + - filename: p6880880_180000_Linux-x86-64.zip + version: 18.3.0.0 + - filename: p6880880_122010_Linux-x86-64.zip + version: 12.2.0.1 + - filename: p6880880_122010_Linux-x86-64.zip + version: 12.1.0.2 + - filename: p6880880_121010_Linux-x86-64.zip + version: 12.1.0.1 + - filename: p6880880_112000_Linux-x86-64.zip + version: 11.2.0.4 + - filename: p6880880_112000_Linux-x86-64.zip + version: 11.2.0.3 default_dbpass: Oracle123 @@ -129,5 +215,5 @@ db_version: "{%- if dbh is defined and db_homes_config[dbh.home] is defined -%} {%- endif -%}" oracle_home_gi: "{% if configure_cluster %}{{ oracle_home_gi_cl }}{% else %}{{ oracle_home_gi_so }}{% endif %}" -oracle_home_gi_cl: "/u01/app/{{ oracle_install_version_gi }}/grid" # ORACLE_HOME for Grid Infrastructure (Clustered) -oracle_home_gi_so: "{{ oracle_base }}/{{ oracle_install_version_gi }}/grid" # ORACLE_HOME for Grid Infrastructure (Stand Alone) \ No newline at end of file +oracle_home_gi_cl: "/u01/app/{{ oracle_install_version_gi }}/grid" # ORACLE_HOME for Grid Infrastructure (Clustered) +oracle_home_gi_so: "{{ oracle_base }}/{{ oracle_install_version_gi }}/grid" # ORACLE_HOME for Grid Infrastructure (Stand Alone) diff --git a/roles/oraswdb-golden-image/meta/main.yml b/roles/oraswdb-golden-image/meta/main.yml index 20862b632..30ea1b718 100644 --- a/roles/oraswdb-golden-image/meta/main.yml +++ b/roles/oraswdb-golden-image/meta/main.yml @@ -1,2 +1,3 @@ +--- dependencies: - - { role: orasw-meta } + - role: orasw-meta diff --git a/roles/oraswdb-golden-image/tasks/main.yml b/roles/oraswdb-golden-image/tasks/main.yml index f5a0fd58c..0708f0770 100644 --- a/roles/oraswdb-golden-image/tasks/main.yml +++ b/roles/oraswdb-golden-image/tasks/main.yml @@ -1,41 +1,44 @@ --- -- assert: - that: golden_image_dest is defined +- name: assert + assert: + that: + - golden_image_dest is defined - block: - - name: Create destination directory for Golden-Image - file: - path: "{{ golden_image_dest }}/{{ dbh.home}}" - state: directory - mode: '0755' - with_items: - - "{{ db_homes_installed | unique }}" - loop_control: - label: "{{ golden_image_dest }}/{{ dbh.home | default('') }}" - loop_var: dbh - when: - - "db_version is version('18', '>=')" + - name: Create destination directory for Golden-Image + file: + path: "{{ golden_image_dest }}/{{ dbh.home }}" + state: directory + mode: '0755' + with_items: + - "{{ db_homes_installed | list | unique }}" + loop_control: + label: "{{ golden_image_dest }}/{{ dbh.home | default('') }}" + loop_var: dbh + when: + - "db_version is version('18', '>=')" - - name: Create Golden-Image - command: "{{ oracle_home_db }}/runInstaller -silent -createGoldImage -destinationLocation {{ golden_image_dest }}/{{ dbh.home}}" - with_items: - - "{{ db_homes_installed | unique }}" - loop_control: - label: "{{ oracle_home_db | default('') }}" - loop_var: dbh - when: - - "db_version is version('18', '>=')" - register: createimage + - name: Create Golden-Image + command: "{{ oracle_home_db }}/runInstaller -silent -createGoldImage -destinationLocation {{ golden_image_dest }}/{{ dbh.home }}" + with_items: + - "{{ db_homes_installed | list | unique }}" + loop_control: + label: "{{ oracle_home_db | default('') }}" + loop_var: dbh + when: + - "db_version is version('18', '>=')" + register: createimage - - debug: msg="{{ item.stdout_lines }}" - with_items: - - "{{ createimage.results }}" - loop_control: - label: "" - when: createimage.results is defined + - name: test + debug: msg="{{ item.stdout_lines }}" + with_items: + - "{{ createimage.results }}" + loop_control: + label: "" + when: createimage.results is defined - become: yes + become: true become_user: "{{ oracle_user }}" when: - - db_homes_installed is defined \ No newline at end of file + - db_homes_installed is defined From 0a2f007c01b9130085946acf3829870735d4b3e4 Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Sat, 11 Sep 2021 08:36:25 +0000 Subject: [PATCH 4/7] Github Actions for Pull-Request This workflow adds ansible-lint for oraswdb-golen-image role. --- .github/workflows/ansible-lint.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/ansible-lint.yml diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml new file mode 100644 index 000000000..67a1ee083 --- /dev/null +++ b/.github/workflows/ansible-lint.yml @@ -0,0 +1,25 @@ +name: Ansible Lint + +on: + pull_request: + +jobs: + build: + + runs-on: ubuntu-20.04 + + steps: + # Important: This sets up your GITHUB_WORKSPACE environment variable + - uses: actions/checkout@v2 + + - name: Lint roles + # Use custom action repo due to open PRs 43 and 48 + uses: Rendanic/ansible-lint-action@tbr + with: + targets: | + roles/oraswdb-golden-image + + override-deps: | + ansible==2.9 + + args: "" From aa1f0453f552816ecc6330cfc9c906f7dbab7c71 Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Sat, 11 Sep 2021 08:49:02 +0000 Subject: [PATCH 5/7] Github Actions: added roles/oradb-manage-statspack --- .github/workflows/ansible-lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml index 67a1ee083..c0cf7b9dc 100644 --- a/.github/workflows/ansible-lint.yml +++ b/.github/workflows/ansible-lint.yml @@ -18,6 +18,7 @@ jobs: with: targets: | roles/oraswdb-golden-image + roles/oradb-manage-statspack override-deps: | ansible==2.9 From 621d764c1bdfcafccbe2ce52f6fe9440e773d3a0 Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Sat, 11 Sep 2021 09:20:20 +0000 Subject: [PATCH 6/7] Github Actions: added roles/orasw-meta --- .github/workflows/ansible-lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml index c0cf7b9dc..bffb2ae0f 100644 --- a/.github/workflows/ansible-lint.yml +++ b/.github/workflows/ansible-lint.yml @@ -19,6 +19,7 @@ jobs: targets: | roles/oraswdb-golden-image roles/oradb-manage-statspack + roles/orasw-meta override-deps: | ansible==2.9 From 98f649a28fcd1c41d8f30435a92895ae66bdf7df Mon Sep 17 00:00:00 2001 From: Thorsten Bruhns Date: Sat, 11 Sep 2021 14:33:17 +0000 Subject: [PATCH 7/7] Github Actions: More rules for Action --- .github/workflows/ansible-lint.yml | 31 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml index bffb2ae0f..b4803b202 100644 --- a/.github/workflows/ansible-lint.yml +++ b/.github/workflows/ansible-lint.yml @@ -2,6 +2,12 @@ name: Ansible Lint on: pull_request: + branches: + - oc + - master + push: + branches: + - 'pr*' jobs: build: @@ -9,19 +15,16 @@ jobs: runs-on: ubuntu-20.04 steps: - # Important: This sets up your GITHUB_WORKSPACE environment variable - - uses: actions/checkout@v2 + # Important: This sets up your GITHUB_WORKSPACE environment variable + - uses: actions/checkout@v2 - - name: Lint roles - # Use custom action repo due to open PRs 43 and 48 - uses: Rendanic/ansible-lint-action@tbr - with: - targets: | - roles/oraswdb-golden-image - roles/oradb-manage-statspack - roles/orasw-meta + - name: Lint roles + # Use custom action repo due to open PRs 43 and 48 + uses: Rendanic/ansible-lint-action@tbr + with: + targets: | + roles/oraswdb-golden-image + roles/oradb-manage-statspack + roles/orasw-meta - override-deps: | - ansible==2.9 - - args: "" + args: ""