Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 4.1.0 #383

Merged
merged 12 commits into from
Nov 8, 2023
Merged
Prev Previous commit
Next Next commit
oraasm_manage_diskgroups: Refactoring and bugfixes for 4.0
  • Loading branch information
Rendanic committed Oct 11, 2023
commit 825ca6ac9a1311bc08f28946af5ac40cc35badac
3 changes: 3 additions & 0 deletions changelogs/fragments/diskgroup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- "oraasm_manage_diskgroups: Refactoring and bugfixes for 4.0 ()"
34 changes: 0 additions & 34 deletions roles/oraasm_manage_diskgroups/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ Do not set them in inventory!
## Table of content

- [Requirements](#requirements)
- [Default Variables](#default-variables)
- [_oraasm_manage_diskgroups_asmdevice_list](#_oraasm_manage_diskgroups_asmdevice_list)
- [_oraasm_manage_diskgroups_attr_name](#_oraasm_manage_diskgroups_attr_name)
- [_oraasm_manage_diskgroups_attr_value](#_oraasm_manage_diskgroups_attr_value)
- [Discovered Tags](#discovered-tags)
- [Open Tasks](#open-tasks)
- [Dependencies](#dependencies)
- [License](#license)
- [Author](#author)
Expand All @@ -27,39 +22,10 @@ Do not set them in inventory!
- Minimum Ansible version: `2.9.0`


## Default Variables

### _oraasm_manage_diskgroups_asmdevice_list

#### Default value

```YAML
_oraasm_manage_diskgroups_asmdevice_list: internal use only
```

### _oraasm_manage_diskgroups_attr_name

#### Default value

```YAML
_oraasm_manage_diskgroups_attr_name: internal use only
```

### _oraasm_manage_diskgroups_attr_value

#### Default value

```YAML
_oraasm_manage_diskgroups_attr_value: internal use only
```

## Discovered Tags

**_diskgroup_**

## Open Tasks

- (bug): missing loop_control

## Dependencies

Expand Down
17 changes: 11 additions & 6 deletions roles/oraasm_manage_diskgroups/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
---
# @todo bug: missing loop_control

- name: oraasm_manage_diskgroups | Manage diskgroups
- name: Manage diskgroups
opitzconsulting.ansible_oracle.oracle_asmdg:
un: sys
pw: "{{ sysasmpassword }}"
sn: +ASM
host: "{{ oracle_hostname }}"
oh: "{{ oracle_home_gi }}"
name: "{{ item.diskgroup }}"
name: "{{ ad_loop.diskgroup }}"
disks: "{{ _oraasm_manage_diskgroups_asmdevice_list }}"
redundancy: "{{ item.redundancy | default(omit) }}"
redundancy: "{{ ad_loop.properties | map(attribute='redundancy') | first | default(omit) }}"
attribute_name: "{{ _oraasm_manage_diskgroups_attr_name | default(omit) }}"
attribute_value: "{{ _oraasm_manage_diskgroups_attr_value | default(omit) }}"
state: "{{ item.state }}"
state: "{{ ad_loop.state }}"
environment: "{{ _grid_env }}"
run_once: "{{ _oraswgi_meta_configure_cluster }}"
become: true
become_user: "{{ _grid_install_user }}"
with_items: "{{ asm_diskgroups }}"
loop_control:
loop_var: ad_loop
label: >-
diskgroup: {{ ad_loop.diskgroup | default('') }}
redundancy: {{ ad_loop.properties | map(attribute='redundancy') | first | default('') }}
state: {{ ad_loop.state | default('') }}
tags: diskgroup
49 changes: 31 additions & 18 deletions roles/oraasm_manage_diskgroups/vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
---
# @var _oraasm_manage_diskgroups_asmdevice_list: $ "internal use only"
_oraasm_manage_diskgroups_asmdevice_list: "{% if device_persistence | lower == 'asmlib' %}\
{%- for disk in item.disk -%}{{ oracle_asm_disk_prefix }}{{ disk.asmlabel | upper }}\
{%- if not loop.last -%},{%- endif -%}\
{%- endfor %}\
{%- elif device_persistence | lower == 'asmfd' %}\
{%- for disk in item.disk -%}AFD:{{ disk.asmlabel | upper }}\
{%- if not loop.last -%},{%- endif -%}\
{%- endfor %}\
{%- elif device_persistence | lower == 'udev' %}\
{%- for disk in item.disk -%}{{ oracle_asm_disk_prefix }}{{ disk.asmlabel }}\
{%- if not loop.last -%},{%- endif -%}\
{%- endfor %}\
{%- endif %}"
_oraasm_manage_diskgroups_asmdevice_list: |-
{% if device_persistence == 'asmlib' %}
{%- for disk in ad_loop.disk %}{{ _oracle_asm_disk_prefix }}{{ disk.asmlabel | upper }}
{%- if not loop.last -%},{%- endif %}
{%- endfor %}
{%- elif device_persistence == 'asmfd' %}
{%- for disk in ad_loop.disk -%}AFD:{{ disk.asmlabel | upper }}
{%- if not loop.last -%},{%- endif -%}
{%- endfor %}
{%- elif device_persistence == 'udev' %}
{%- for disk in ad_loop.disk -%}{{ _oracle_asm_disk_prefix }}{{ disk.asmlabel }}
{%- if not loop.last -%},{%- endif -%}
{%- endfor %}
{%- endif %}

# @var _oraasm_manage_diskgroups_attr_name: $ "internal use only"
_oraasm_manage_diskgroups_attr_name: "{% if item.attributes is defined %}{{ item.attributes | default(omit) | map(attribute='name') | list }}{% else %}None{% endif %}"
_oraasm_manage_diskgroups_attr_name: |-
{% if ad_loop.attributes is defined %}
{{- ad_loop.attributes | default(omit) | map(attribute='name') | list }}
{%- else %}None{% endif %}

# @var _oraasm_manage_diskgroups_attr_value: $ "internal use only"
_oraasm_manage_diskgroups_attr_value: "{% if item.attributes is defined %}{{ item.attributes | default(omit) | map(attribute='value') | list }}{% else %}None{% endif %}"
_oraasm_manage_diskgroups_attr_value: |-
{% if ad_loop.attributes is defined %}
{{- ad_loop.attributes | default(omit) | map(attribute='value') | list }}
{%- else %}None{% endif %}

_oracle_asm_disk_prefix: |-
{%- if device_persistence == 'asmlib' %}
{%- if oracle_asm_disk_string.endswith('*') %}{{ oracle_asm_disk_string[:-1] }}
{%- else %}{{ oracle_asm_disk_string }}
{%- endif %}
{%- elif device_persistence == 'udev' %}{{ oracle_asm_disk_string }}
{%- else %}
{%- endif %}