Skip to content

Commit 2079fbb

Browse files
committed
- Simplified the way partitioning is done, no need for shellscripts anymore.
- Added partitionsuffix, based on OS version & whether or not dm-multipath is used
1 parent f001fe3 commit 2079fbb

File tree

7 files changed

+26
-32
lines changed

7 files changed

+26
-32
lines changed

roles/oradb-create/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
- customdbcatemplate
2727

2828
- name: Create responsefile for dbca
29-
template: src=dbca-create-db.rsp.{{ item.0.oracle_version_db }}.j2 dest={{ oracle_rsp_stage }}/{{ oracle_dbca_rsp }} owner={{ oracle_user }} group={{ oracle_group }} mode=644 backup=no
29+
template: src=dbca-create-db.rsp.{{ item.0.oracle_version_db }}.j2 dest={{ oracle_rsp_stage }}/{{ oracle_dbca_rsp }} owner={{ oracle_user }} group={{ oracle_group }} mode=600 backup=no
3030
#debug: var=msg
3131
with_together:
3232
- "{{oracle_databases}}"

roles/orahost-storage/defaults/main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22

33
multipath: none # dm-multipath (Linux device mapper multipath)
44
device_persistence: asmlib
5-
oracle_asm_disk_string: "{% if device_persistence == 'asmlib' %}{% elif device_persistence == 'udev' %}/dev/oracle/{% else %}{% endif %}"
5+
oracle_asm_disk_string: "{% if device_persistence|lower == 'asmlib' %}{% elif device_persistence |lower == 'udev' %}/dev/oracle/{% else %}{% endif %}"
66
oracle_stage: /u01/stage
77
oracle_rsp_stage: "{{ oracle_stage }}/rsp"
88
oracle_user: oracle
99
grid_user: grid
10-
grid_install_user: "{% if role_separation==true %}{{ grid_user }}{% else %}{{ oracle_user }}{% endif %}"
10+
grid_install_user: "{% if role_separation %}{{ grid_user }}{% else %}{{ oracle_user }}{% endif %}"
1111
oracle_group: oinstall
1212
asmdba_group: asmdba
13+
asmadmin_group: asmadmin
1314
dba_group: dba
1415
partition_devices: true
1516
use_partition_devices: true
17+
partition_suffix: "{% if multipath |lower == 'dm-multipath' and ansible_distribution_major_version|int == 6 %}p1{% else %}1{% endif%}"
1618
asmlib_binary: "{% if ansible_distribution_major_version|int == 7 %}oracleasm{% elif ansible_distribution_major_version|int == 6 %}/etc/init.d/oracleasm{% else %}/etc/init.d/oracleasm{% endif%}"
1719

1820

roles/orahost-storage/tasks/asmlib.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11

2-
- name: ASMlib | Build script to create asmlib-labels
3-
template: src=label-asm-disks.sh.j2 dest={{ oracle_rsp_stage }}/label-asm-disks-{{ item.diskgroup }}.sh mode=775
4-
with_items: "{{asm_diskgroups}}"
5-
when: master_node and device_persistence == 'asmlib' and asm_diskgroups is defined
6-
tags: asmlibconfig,asmstorage
7-
8-
- name: ASMlib | Run script to create asmlib-labels
9-
shell: sh {{ oracle_rsp_stage }}/label-asm-disks-{{ item.diskgroup }}.sh
10-
with_items: "{{asm_diskgroups}}"
2+
- name: ASM-storage | create asmlib labels
3+
shell: "{{ asmlib_binary}} createdisk {{item.1.asmlabel}} {{ item.1.device }}{{ partition_suffix}}"
4+
args:
5+
creates: "/dev/oracleasm/disks/{{ item.1.asmlabel | upper}}"
6+
with_subelements:
7+
- "{{asm_diskgroups}}"
8+
- disk
119
when: master_node and device_persistence == 'asmlib' and asm_diskgroups is defined
1210
tags: asmlibconfig,asmstorage
1311

1412
- name: ASMlib | Rescan ASM disks
1513
shell: "{{asmlib_binary}} scandisks"
1614
when: device_persistence == 'asmlib'
15+
changed_when: False
1716
tags: asmlibconfig,asmstorage
1817

1918
- name: ASMlib | List ASM disks
2019
shell: "{{asmlib_binary}} listdisks"
2120
when: device_persistence == 'asmlib'
2221
register: listdisks
22+
changed_when: False
2323
tags: asmlibconfig,asmstorage
2424

2525
- name: ASMlib | List ASM disks

roles/orahost-storage/tasks/dm-multipath-kpartx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
- name: ASM-storage | run kpartx to add partition
44
shell: kpartx -a {{ item.1.device}}
55
args:
6-
creates: "{{ item.1.device}}p1"
6+
creates: "{{ item.1.device}}{{partition_suffix}}"
77
with_subelements:
88
- "{{asm_diskgroups}}"
99
- disk

roles/orahost-storage/tasks/main.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
# Partition & ASM-Label Shared disks
2-
---
3-
- name: ASM-storage | Create device to label mappings for asm
4-
template: src=asm-label-device-mapping.txt.j2 dest={{ oracle_rsp_stage }}/asm-label-device-mapping-{{ item.diskgroup }}.txt
5-
with_items: "{{asm_diskgroups}}"
6-
when: master_node and asm_diskgroups is defined
7-
tags: asmstorage
82

9-
- name: ASM-storage | Build script to create partitions
10-
template: src=part-device.sh.j2 dest={{ oracle_rsp_stage }}/part-device-{{ item.diskgroup }}.sh mode=775
11-
with_items: "{{asm_diskgroups}}"
12-
when: master_node and asm_diskgroups is defined
13-
tags: asmstorage
14-
15-
- name: ASM-storage | Run script to create partitions
16-
shell: sh {{ oracle_rsp_stage }}/part-device-{{ item.diskgroup }}.sh
17-
with_items: "{{asm_diskgroups}}"
3+
- name: ASM-storage | partition devices
4+
shell: parted {{ item.1.device }} "mklabel gpt mkpart primary 1 -1"
5+
args:
6+
creates: "{{ item.1.device}}{{partition_suffix}}"
7+
with_subelements:
8+
- "{{asm_diskgroups}}"
9+
- disk
1810
when: master_node and partition_devices and asm_diskgroups is defined
19-
tags: asmstorage
11+
tags: asmstorage,partition
2012

2113
- include: dm-multipath-kpartx.yml
2214
when: multipath == 'dm-multipath' and partition_devices and asm_diskgroups is defined
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% for disk in asm_storage_layout[item] %}
22
{% if use_partition_devices %}
3-
KERNEL=="{{ disk.device.split("/")[-1] }}1", NAME="{{oracle_asm_disk_string.split("/",2)[-1] }}{{ disk.asmlabel }}", OWNER="{{ grid_install_user }}", GROUP={% if role_separation==True %}"{{ asmdba_group }}"{% else %}"{{ dba_group }}"{% endif %}, MODE="0660"
3+
KERNEL=="{{ disk.device.split("/")[-1] }}{{partition_suffix}}", NAME="{{oracle_asm_disk_string.split("/",2)[-1] }}{{ disk.asmlabel }}", OWNER="{{ grid_install_user }}", GROUP="{{ asmadmin_group }}", MODE="0660"
44
{% elif not use_partition_devices %}
5-
KERNEL=="{{ disk.device.split("/")[-1] }}", NAME="{{oracle_asm_disk_string.split("/",2)[-1] }}{{ disk.asmlabel }}", OWNER="{{ grid_install_user }}", GROUP={% if role_separation==True %}"{{ asmdba_group }}"{% else %}"{{ dba_group }}"{% endif %}, MODE="0660"
5+
KERNEL=="{{ disk.device.split("/")[-1] }}", NAME="{{oracle_asm_disk_string.split("/",2)[-1] }}{{ disk.asmlabel }}", OWNER="{{ grid_install_user }}", GROUP="{{ asmadmin_group }}", MODE="0660"
66
{% endif %}
77
{% endfor %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{% for disk in item.disk %}
2-
{{ disk.device }} {{oracle_asm_disk_string.split("/",2)[-1] }}{{ disk.asmlabel }} {{ grid_install_user }} {% if role_separation==True %}{{ asmdba_group }}{% else %}{{ dba_group }}{% endif %}
2+
{{ disk.device }} {{oracle_asm_disk_string.split("/",2)[-1] }}{{ disk.asmlabel }} {{ grid_install_user }} {{ asmadmin_group }}
33

44
{% endfor %}

0 commit comments

Comments
 (0)