Skip to content

Commit

Permalink
oracluvfy: New role for managing cluvfy
Browse files Browse the repository at this point in the history
The following patch could be added to oracle_sw_patches for downloading
the cluvfy from Oracle.

oracle_sw_patches:
  - filename: cvupack_linux_ol7_x86_64.zip
    patchid: 30839369
    version: 21.0.0.0
    description: Latest cluvfy
  • Loading branch information
Rendanic committed Mar 30, 2024
1 parent 1318950 commit 47e6019
Show file tree
Hide file tree
Showing 12 changed files with 281 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelogs/fragments/oracluvfy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- "oracluvfy: New role for managing cluvfy (oravirt#423)"
5 changes: 5 additions & 0 deletions roles/oracluvfy/.ansibledoctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
logging:
level: warning
template: readme
force_overwrite: true
70 changes: 70 additions & 0 deletions roles/oracluvfy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# oracluvfy

Manage Cluster Verification Utility from Oracle

## Table of content

- [Requirements](#requirements)
- [Default Variables](#default-variables)
- [oracluvfy_archive](#oracluvfy_archive)
- [oracluvfy_force_update](#oracluvfy_force_update)
- [oracluvfy_home](#oracluvfy_home)
- [Discovered Tags](#discovered-tags)
- [Dependencies](#dependencies)
- [License](#license)
- [Author](#author)

---

## Requirements

- Minimum Ansible version: `2.14.0`

## Default Variables

### oracluvfy_archive

ZIP Archive used by the role.

#### Default value

```YAML
oracluvfy_archive: cvupack_linux_ol7_x86_64.zip
```
### oracluvfy_force_update
Force unarchive of cluvfy in `oracluvfy_home`.

#### Default value

```YAML
oracluvfy_force_update: false
```

### oracluvfy_home

#### Default value

```YAML
oracluvfy_home: '{{ oracle_base }}/product/cluvfy'
```

## Discovered Tags

**_always_**

**_assert_**


## Dependencies

- orasw_meta

## License

license (MIT)

## Author

[Thorsten Bruhns]
14 changes: 14 additions & 0 deletions roles/oracluvfy/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
# @var oracluvfy_home:description: >
# @end
oracluvfy_home: "{{ oracle_base }}/product/cluvfy"

# @var oracluvfy_archive:description: >
# ZIP Archive used by the role.
# @end
oracluvfy_archive: cvupack_linux_ol7_x86_64.zip

# @var oracluvfy_force_update:description: >
# Force unarchive of cluvfy in `oracluvfy_home`.
# @end
oracluvfy_force_update: false
28 changes: 28 additions & 0 deletions roles/oracluvfy/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
# @meta description: >
# Manage Cluster Verification Utility from Oracle
# @end
# @meta author: [Thorsten Bruhns]
galaxy_info:
role_name: oracluvfy
author: Thorsten Bruhns
description: Manage cluvfy for Oracle Grid-Infrastructure/Restart
company: Thorsten Bruhns

license: license (MIT)

min_ansible_version: 2.14.0

platforms:
- name: EL
versions:
- "6"
- "7"
- "8"

galaxy_tags:
- database
- oracle

dependencies:
- role: orasw_meta
15 changes: 15 additions & 0 deletions roles/oracluvfy/tasks/assert.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
- name: Assert variables
ansible.builtin.assert:
quiet: true
that:
- oracluvfy_home is defined
- oracle_base is defined
- oracle_stage is defined

- name: Show variables
ansible.builtin.debug:
msg:
- "oracluvfy_home: {{ oracluvfy_home }}"
- "oracluvfy_archive: {{ oracluvfy_archive }}"
- "oracluvfy_force_update: {{ oracluvfy_force_update }}"
42 changes: 42 additions & 0 deletions roles/oracluvfy/tasks/execute_cluvfy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
# run cluvfy comp sys ...
- name: execute_cluvfy | Execute cluvfy
block:
- name: execute_cluvfy | Assert parameter
ansible.builtin.assert:
quiet: false
that:
- cluvfy_args is defined
- cluvfy_args | length > 2
success_msg: >-
Parameter: {{ cluvfy_args }}
- name: execute_cluvfy | Check for executable
ansible.builtin.stat:
path: "{{ _oracluvfy_executable }}"
register: _oracluvfy_executable_stat

- name: execute_cluvfy | Install cluvfy
ansible.builtin.include_tasks: install_cluvfy.yml
when:
- not _oracluvfy_executable_stat.stat.exists

- name: execute_cluvfy | Execute cluvfy
ansible.builtin.command: >-
{{ _oracluvfy_executable }} {{ cluvfy_args }}
args:
chdir: "{{ oracluvfy_home }}"
register: cluvfy_execute_res
changed_when: cluvfy_execute_res.rc == 0
become: true
become_user: "{{ _grid_install_user }}"

rescue:
- name: execute_cluvfy | cluvfy failed
ansible.builtin.fail:
msg: See next task for details

always:
- name: execute_cluvfy | Show result
ansible.builtin.debug:
var: cluvfy_execute_res.stdout_lines
70 changes: 70 additions & 0 deletions roles/oracluvfy/tasks/install_cluvfy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
- name: Assert
ansible.builtin.include_tasks: assert.yml
tags:
- assert
- always

- name: install_cluvfy | Install
become: true
become_user: "{{ _grid_install_user }}"
vars:
_creates: >-
{{ oracluvfy_force_update | bool | ternary((oracluvfy_home + '/missing_file'), _oracluvfy_executable) }}
block:
- name: install_cluvfy | download cluvfy (copy)
ansible.builtin.copy:
src: "{{ oracle_sw_source_local }}/{{ oracluvfy_archive }}"
dest: "{{ oracle_stage }}"
mode: 0664
force: false
remote_src: false
when:
- is_sw_source_local
- oracle_sw_copy
- not _oracluvfy_executable_stat.stat.exists | default(false) or oracluvfy_force_update

- name: install_cluvfy | download cluvfy (www)
ansible.builtin.get_url:
url: "{{ oracle_sw_source_www }}/{{ oracluvfy_archive }}"
dest: "{{ oracle_stage }}"
mode: 0644
force: false
when:
- not is_sw_source_local
- oracle_sw_copy
- not _oracluvfy_executable_stat.stat.exists | default(false) or oracluvfy_force_update

- name: install_cluvfy | Create target directory
ansible.builtin.file:
path: "{{ oracluvfy_home }}"
mode: "0755"
recurse: true
state: directory

- name: install_cluvfy | Unarchive cluvfy archive
ansible.builtin.unarchive:
src: "{{ _oracluvfy_stage }}/{{ oracluvfy_archive }}"
dest: "{{ oracluvfy_home }}"
copy: false
args:
creates: "{{ _creates }}"

- name: install_cluvfy | Remove local copy of {{ oracluvfy_archive }}
ansible.builtin.file:
path: "{{ _oracluvfy_stage }}/{{ oracluvfy_archive }}"
state: absent
when:
- oracle_sw_copy

- name: install_cluvfy | Show installed version
ansible.builtin.command: >-
{{ _oracluvfy_executable }} -version
args:
chdir: "{{ oracluvfy_home }}"
register: cluvfy_version_res
changed_when: cluvfy_version_res.rc == 0

- name: install_cluvfy | Show version
ansible.builtin.debug:
var: cluvfy_version_res.stdout_lines
1 change: 1 addition & 0 deletions roles/oracluvfy/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
15 changes: 15 additions & 0 deletions roles/oracluvfy/tasks/run_cluvfy_comp_healthcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
# run cluvfy comp healthcheck ...
- name: run_cluvfy_comp_sys | Execute cluvfy comp healthcheck
ansible.builtin.include_tasks: execute_cluvfy.yml
vars:
cluvfy_args: >-
comp healthcheck
-collect cluster
- name: run_cluvfy_comp_sys | Execute cluvfy comp healthcheck
ansible.builtin.include_tasks: execute_cluvfy.yml
vars:
cluvfy_args: >-
comp healthcheck
-collect asm
13 changes: 13 additions & 0 deletions roles/oracluvfy/tasks/run_cluvfy_comp_sys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
# run cluvfy comp sys ...
- name: run_cluvfy_comp_sys | Execute cluvfy comp sys
ansible.builtin.include_tasks: execute_cluvfy.yml
vars:
cluvfy_args: >-
comp sys
-p
{% if oracle_install_option_gi == 'HA_CONFIG' %}ha{% endif %}
-osdba {{ dba_group }}
-osoper {{ oper_group }}
# oracle_install_option_gi: HA_CONFIG
5 changes: 5 additions & 0 deletions roles/oracluvfy/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
_oracluvfy_executable: "{{ oracluvfy_home }}/bin/cluvfy"

_oracluvfy_stage: >-
{{ oracle_sw_copy | bool | ternary(oracle_stage, oracle_stage_remote) }}

0 comments on commit 47e6019

Please sign in to comment.