Skip to content

Commit 9f705e6

Browse files
committed
oracluvfy: New role for managing cluvfy
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
1 parent 3f9c96c commit 9f705e6

File tree

12 files changed

+281
-0
lines changed

12 files changed

+281
-0
lines changed

changelogs/fragments/oracluvfy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
minor_changes:
3+
- "oracluvfy: New role for managing cluvfy ()"

roles/oracluvfy/.ansibledoctor.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
logging:
3+
level: warning
4+
template: readme
5+
force_overwrite: true

roles/oracluvfy/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# oracluvfy
2+
3+
Manage Cluster Verification Utility from Oracle
4+
5+
## Table of content
6+
7+
- [Requirements](#requirements)
8+
- [Default Variables](#default-variables)
9+
- [oracluvfy_archive](#oracluvfy_archive)
10+
- [oracluvfy_force_update](#oracluvfy_force_update)
11+
- [oracluvfy_home](#oracluvfy_home)
12+
- [Discovered Tags](#discovered-tags)
13+
- [Dependencies](#dependencies)
14+
- [License](#license)
15+
- [Author](#author)
16+
17+
---
18+
19+
## Requirements
20+
21+
- Minimum Ansible version: `2.14.0`
22+
23+
## Default Variables
24+
25+
### oracluvfy_archive
26+
27+
ZIP Archive used by the role.
28+
29+
#### Default value
30+
31+
```YAML
32+
oracluvfy_archive: cvupack_linux_ol7_x86_64.zip
33+
```
34+
35+
### oracluvfy_force_update
36+
37+
Force unarchive of cluvfy in `oracluvfy_home`.
38+
39+
#### Default value
40+
41+
```YAML
42+
oracluvfy_force_update: false
43+
```
44+
45+
### oracluvfy_home
46+
47+
#### Default value
48+
49+
```YAML
50+
oracluvfy_home: '{{ oracle_base }}/product/cluvfy'
51+
```
52+
53+
## Discovered Tags
54+
55+
**_always_**
56+
57+
**_assert_**
58+
59+
60+
## Dependencies
61+
62+
- orasw_meta
63+
64+
## License
65+
66+
license (MIT)
67+
68+
## Author
69+
70+
[Thorsten Bruhns]

roles/oracluvfy/defaults/main.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
# @var oracluvfy_home:description: >
3+
# @end
4+
oracluvfy_home: "{{ oracle_base }}/product/cluvfy"
5+
6+
# @var oracluvfy_archive:description: >
7+
# ZIP Archive used by the role.
8+
# @end
9+
oracluvfy_archive: cvupack_linux_ol7_x86_64.zip
10+
11+
# @var oracluvfy_force_update:description: >
12+
# Force unarchive of cluvfy in `oracluvfy_home`.
13+
# @end
14+
oracluvfy_force_update: false

roles/oracluvfy/meta/main.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
# @meta description: >
3+
# Manage Cluster Verification Utility from Oracle
4+
# @end
5+
# @meta author: [Thorsten Bruhns]
6+
galaxy_info:
7+
role_name: oracluvfy
8+
author: Thorsten Bruhns
9+
description: Manage cluvfy for Oracle Grid-Infrastructure/Restart
10+
company: Thorsten Bruhns
11+
12+
license: license (MIT)
13+
14+
min_ansible_version: 2.14.0
15+
16+
platforms:
17+
- name: EL
18+
versions:
19+
- "6"
20+
- "7"
21+
- "8"
22+
23+
galaxy_tags:
24+
- database
25+
- oracle
26+
27+
dependencies:
28+
- role: orasw_meta

roles/oracluvfy/tasks/assert.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
- name: Assert variables
3+
ansible.builtin.assert:
4+
quiet: true
5+
that:
6+
- oracluvfy_home is defined
7+
- oracle_base is defined
8+
- oracle_stage is defined
9+
10+
- name: Show variables
11+
ansible.builtin.debug:
12+
msg:
13+
- "oracluvfy_home: {{ oracluvfy_home }}"
14+
- "oracluvfy_archive: {{ oracluvfy_archive }}"
15+
- "oracluvfy_force_update: {{ oracluvfy_force_update }}"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
# run cluvfy comp sys ...
3+
- name: execute_cluvfy | Execute cluvfy
4+
block:
5+
- name: execute_cluvfy | Assert parameter
6+
ansible.builtin.assert:
7+
quiet: false
8+
that:
9+
- cluvfy_args is defined
10+
- cluvfy_args | length > 2
11+
success_msg: >-
12+
Parameter: {{ cluvfy_args }}
13+
14+
- name: execute_cluvfy | Check for executable
15+
ansible.builtin.stat:
16+
path: "{{ _oracluvfy_executable }}"
17+
register: _oracluvfy_executable_stat
18+
19+
- name: execute_cluvfy | Install cluvfy
20+
ansible.builtin.include_tasks: install_cluvfy.yml
21+
when:
22+
- not _oracluvfy_executable_stat.stat.exists
23+
24+
- name: execute_cluvfy | Execute cluvfy
25+
ansible.builtin.command: >-
26+
{{ _oracluvfy_executable }} {{ cluvfy_args }}
27+
args:
28+
chdir: "{{ oracluvfy_home }}"
29+
register: cluvfy_execute_res
30+
changed_when: cluvfy_execute_res.rc == 0
31+
become: true
32+
become_user: "{{ oracle_user }}"
33+
34+
rescue:
35+
- name: execute_cluvfy | cluvfy failed
36+
ansible.builtin.fail:
37+
msg: See next task for details
38+
39+
always:
40+
- name: execute_cluvfy | Show result
41+
ansible.builtin.debug:
42+
var: cluvfy_execute_res.stdout_lines
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
- name: Assert
3+
ansible.builtin.include_tasks: assert.yml
4+
tags:
5+
- assert
6+
- always
7+
8+
- name: install_cluvfy | Install
9+
become: true
10+
become_user: "{{ oracle_user }}"
11+
vars:
12+
_creates: >-
13+
{{ oracluvfy_force_update | bool | ternary((oracluvfy_home + '/missing_file'), _oracluvfy_executable) }}
14+
block:
15+
- name: install_cluvfy | download cluvfy (copy)
16+
ansible.builtin.copy:
17+
src: "{{ oracle_sw_source_local }}/{{ oracluvfy_archive }}"
18+
dest: "{{ oracle_stage }}"
19+
mode: 0664
20+
force: false
21+
remote_src: false
22+
when:
23+
- is_sw_source_local
24+
- oracle_sw_copy
25+
- not _oracluvfy_executable_stat.stat.exists | default(false) or oracluvfy_force_update
26+
27+
- name: install_cluvfy | download cluvfy (www)
28+
ansible.builtin.get_url:
29+
url: "{{ oracle_sw_source_www }}/{{ oracluvfy_archive }}"
30+
dest: "{{ oracle_stage }}"
31+
mode: 0644
32+
force: false
33+
when:
34+
- not is_sw_source_local
35+
- oracle_sw_copy
36+
- not _oracluvfy_executable_stat.stat.exists | default(false) or oracluvfy_force_update
37+
38+
- name: install_cluvfy | Create target directory
39+
ansible.builtin.file:
40+
path: "{{ oracluvfy_home }}"
41+
mode: "0755"
42+
recurse: true
43+
state: directory
44+
45+
- name: install_cluvfy | Unarchive cluvfy archive
46+
ansible.builtin.unarchive:
47+
src: "{{ _oracluvfy_stage }}/{{ oracluvfy_archive }}"
48+
dest: "{{ oracluvfy_home }}"
49+
copy: false
50+
args:
51+
creates: "{{ _creates }}"
52+
53+
- name: install_cluvfy | Remove local copy of {{ oracluvfy_archive }}
54+
ansible.builtin.file:
55+
path: "{{ _oracluvfy_stage }}/{{ oracluvfy_archive }}"
56+
state: absent
57+
when:
58+
- oracle_sw_copy
59+
60+
- name: install_cluvfy | Show installed version
61+
ansible.builtin.command: >-
62+
{{ _oracluvfy_executable }} -version
63+
args:
64+
chdir: "{{ oracluvfy_home }}"
65+
register: cluvfy_version_res
66+
changed_when: cluvfy_version_res.rc == 0
67+
68+
- name: install_cluvfy | Show version
69+
ansible.builtin.debug:
70+
var: cluvfy_version_res.stdout_lines

roles/oracluvfy/tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
---
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
# run cluvfy comp healthcheck ...
3+
- name: run_cluvfy_comp_sys | Execute cluvfy comp healthcheck
4+
ansible.builtin.include_tasks: execute_cluvfy.yml
5+
vars:
6+
cluvfy_args: >-
7+
comp healthcheck
8+
-collect cluster
9+
10+
- name: run_cluvfy_comp_sys | Execute cluvfy comp healthcheck
11+
ansible.builtin.include_tasks: execute_cluvfy.yml
12+
vars:
13+
cluvfy_args: >-
14+
comp healthcheck
15+
-collect asm

0 commit comments

Comments
 (0)