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

Change script to run yamllint #280

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
- ansible/**
- requirements.txt
- .github/workflows/ansible.yml
- Makefile
- tools/**

jobs:
build:
Expand Down
10 changes: 2 additions & 8 deletions ansible/roles/qe_sap_storage/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,16 @@ sap_storage_sap_type: 'sap_onehost'
sap_storage_action: 'prepare'
# prepare | remove


# Azure variables

sap_storage_az_imds_json:
sap_storage_az_imds_url: 'http://169.254.169.254/metadata/instance/compute?api-version=2020-09-01'
sap_storage_az_vmsize_url: 'http://169.254.169.254/metadata/instance/compute/vmSize?api-version=2017-08-01&format=text'

sap_storage_az_vmsize:

sap_storage_az_lun: '/dev/disk/azure/scsi1/lun'

# AWS variables

sap_storage_aws_imds_url:
sap_storage_aws_vmsize_url:

sap_storage_aws_imds_url:
sap_storage_aws_vmsize_url:
sap_storage_aws_vmsize:

# IBM Cloud variables
6 changes: 3 additions & 3 deletions ansible/roles/qe_sap_storage/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ galaxy_info:
min_ansible_version: 2.9
platforms:
- name: EL
versions: [ 7, 8, 9 ]
versions: [7, 8, 9]
- name: SLES
versions: [ 15SP3 ]
galaxy_tags: [ 'sap', 'rhel', 'redhat', 'sles', 'suse' ]
versions: [15SP3]
galaxy_tags: ['sap', 'rhel', 'redhat', 'sles', 'suse']
dependencies: []
20 changes: 10 additions & 10 deletions ansible/roles/qe_sap_storage/tasks/az_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@
# Create json format of IMDS
# Todo: Ansibilize this
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - Create json format of IMDS
shell: |
ansible.builtin.shell: |
curl -H Metadata:true --noproxy "*" "{{ sap_storage_az_imds_url }}" | python3 -mjson.tool
register: az_imds_reg
args:
executable: /bin/bash
# If this fails, that means this VM is not Azure?

- set_fact:
sap_storage_az_imds_json: "{{ az_imds_reg.stdout }}"
- ansible.builtin.set_fact:
sap_storage_az_imds_json: "{{ az_imds_reg.stdout }}"

# Pull VMSize
# Todo: Ansibilize this
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - Pull VMSize
shell: |
ansible.builtin.shell: |
curl -H Metadata:true --noproxy "*" "{{ sap_storage_az_vmsize_url }}"
register: az_vmsize_reg
args:
executable: /bin/bash

- debug:
msg:
- "{{ az_vmsize_reg.stdout }}"
- ansible.builtin.debug:
msg:
- "{{ az_vmsize_reg.stdout }}"

- set_fact:
sap_storage_az_vmsize: "{{ az_vmsize_reg.stdout }}"
- ansible.builtin.set_fact:
sap_storage_az_vmsize: "{{ az_vmsize_reg.stdout }}"

# Include vars depending on VM Size
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - Load Variables for {{ sap_storage_az_vmsize }}
include_vars: "{{ sap_storage_cloud_type }}_tasks/vmsizes/{{ sap_storage_az_vmsize }}.yml"
ansible.builtin.include_vars: "{{ sap_storage_cloud_type }}_tasks/vmsizes/{{ sap_storage_az_vmsize }}.yml"
32 changes: 16 additions & 16 deletions ansible/roles/qe_sap_storage/tasks/az_tasks/prepare_storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# Striped volume
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} - Striped
block:

# Get LUNs from metadata
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Get LUNs from metadata
shell: |
ansible.builtin.shell: |
for i in {1..{{ item.value.numluns }}}
do
{{ item.value.vg }}${i}lun="{{ sap_storage_az_lun }} \
Expand All @@ -20,26 +20,26 @@
args:
executable: /bin/bash
register: pvs_reg
- set_fact:

- ansible.builtin.set_fact:
pvs_list: "{{ pvs_reg.stdout.split() }}"

# Create Volume Group
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Volume Group Striped
lvg:
community.general.lvg:
vg: "{{ item.value.vg }}"
pvs: "{{ pvs_list | join(',') }}"
force: yes
force: true

# Create Logical Group
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Logical Volume - Striped
lvol:
community.general.lvol:
vg: "{{ item.value.vg }}"
lv: "{{ item.value.lv }}"
size: 100%VG
opts: "-i{{ item.value.numluns }} -I{{ item.value.stripesize }}"

when:
when:
- "item.value.numluns != '1'"

# Single volume
Expand All @@ -48,7 +48,7 @@

# Get LUNs from metadata
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Get LUNs from metadata
shell: |
ansible.builtin.shell: |
{{ item.value.vg }}lun="{{ sap_storage_az_lun }} \
`awk '/caching/ { r=""; f=1 } f { r = (r ? r ORS : "") $0 } \
/writeAcceleratorEnabled/ \
Expand All @@ -60,35 +60,35 @@
executable: /bin/bash
register: pvs_reg

- set_fact:
- ansible.builtin.set_fact:
pvs_one: "{{ pvs_reg.stdout }}"

# Create Volume Group
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Volume Group One
lvg:
community.general.lvg:
vg: "{{ item.value.vg }}"
pvs: "{{ pvs_one }}"
force: yes
force: true

# Create Logical Group
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Logical Volume - One
lvol:
community.general.lvol:
vg: "{{ item.value.vg }}"
lv: "{{ item.value.lv }}"
size: 100%VG

when:
when:
- "item.value.numluns == '1'"

# Create Filesystem
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Filesystem
filesystem:
community.general.filesystem:
fstype: xfs
dev: "/dev/{{ item.value.vg }}/{{ item.value.lv }}"

# Mount Filesystem
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Mount
mount:
ansible.posix.mount:
path: "{{ item.value.directory }}"
fstype: xfs
src: "/dev/mapper/{{ item.value.vg }}-{{ item.value.lv }}"
Expand Down
12 changes: 6 additions & 6 deletions ansible/roles/qe_sap_storage/tasks/az_tasks/remove_storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@

# Unmount Filesystem
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Unmount Filesystem
mount:
ansible.posix.mount:
path: "{{ item.value.directory }}"
state: absent

# Remove Filesystem
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Filesystem
shell: |
ansible.builtin.shell: |
/sbin/wipefs --all -f /dev/mapper/{{ item.value.vg }}-{{ item.value.lv }}

# Remove Logical Volume
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Logical Volume
lvol:
community.general.lvol:
lv: "{{ item.value.lv }}"
vg: "{{ item.value.vg }}"
state: absent
force: yes
force: true

# Remove Volume Group
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Volume Group
lvg:
community.general.lvg:
vg: "{{ item.value.vg }}"
state: absent
force: yes
force: true
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
---

- debug:
- ansible.builtin.debug:
msg: "{{ item }} "

# Create Volume Group
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Volume Group One
lvg:
community.general.lvg:
vg: "{{ item.value.vg }}"
pvs: "{{ item.value.pv }}"
force: yes
force: true

# Create Logical Group - One
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Logical Volume - One
lvol:
community.general.lvol:
vg: "{{ item.value.vg }}"
lv: "{{ item.value.lv }}"
size: 100%VG
when:
when:
- "item.value.numluns == '1'"

# Create Logical Group - Striped
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Logical Volume - Striped
lvol:
community.general.lvol:
vg: "{{ item.value.vg }}"
lv: "{{ item.value.lv }}"
size: 100%VG
opts: "-i {{ item.value.numluns }} -I {{ item.value.stripesize }}"
when:
when:
- "item.value.numluns != '1'"

# Create Filesystem
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Filesystem
filesystem:
community.general.filesystem:
fstype: xfs
dev: "/dev/{{ item.value.vg }}/{{ item.value.lv }}"

# Mount Filesystem
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Mount
mount:
ansible.posix.mount:
path: "{{ item.value.directory }}"
fstype: xfs
src: "/dev/mapper/{{ item.value.vg }}-{{ item.value.lv }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Filesystem
shell: |
/sbin/wipefs --all -f /dev/mapper/{{ item.value.vg }}-{{ item.value.lv }}
ignore_errors: yes
ignore_errors: true

# Remove Logical Volume
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Logical Volume
lvol:
lv: "{{ item.value.lv }}"
vg: "{{ item.value.vg }}"
state: absent
force: yes
force: true

# Remove Volume Group
- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Volume Group
lvg:
vg: "{{ item.value.vg }}"
state: absent
force: yes
force: true
2 changes: 1 addition & 1 deletion ansible/roles/sap_ha_install_hana_hsr/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ sap_ha_install_hana_hsr_fqdn: "{{ sap_domain }}"
sap_ha_install_hana_hsr_rep_mode: sync
sap_ha_install_hana_hsr_oper_mode: logreplay

sap_ha_install_hana_hsr_update_etchosts: yes
sap_ha_install_hana_hsr_update_etchosts: true
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
path: /etc/hosts
create: true
state: present
backup: yes
backup: true
line: "{{ item.node_ip }}\t{{ item.node_name }}.{{ sap_ha_install_hana_hsr_fqdn }}\t{{ item.node_name }}"
regexp: (?i)^\s*{{ item.node_ip }}\s+{{ item.node_name }}
loop: "{{ sap_ha_install_hana_hsr_cluster_nodes }}"
Expand Down
Loading
Loading