Skip to content

Commit

Permalink
Use full path names for all modules (#61)
Browse files Browse the repository at this point in the history
* Use FQCN for all module names

* Fix name[casing] linting issues

* fix var spacing

* fix pipeline linting command
  • Loading branch information
velomatt authored Nov 21, 2023
1 parent e227447 commit c60d819
Show file tree
Hide file tree
Showing 191 changed files with 893 additions and 893 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ stages:

ansible-lint:
stage: lint
script: ansible-lint .
script: ansible-lint *
2 changes: 1 addition & 1 deletion buildspec/ansible-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ phases:
build:
commands:
- echo Running ansible-lint ...
- ansible-lint .
- ansible-lint *
6 changes: 3 additions & 3 deletions playbooks/deploy_dss_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
- validate_ansible

- name: Download Artifacts
import_playbook: download_artifacts.yml
ansible.builtin.import_playbook: download_artifacts.yml

- name: Check IOMMU Off
gather_facts: false
Expand Down Expand Up @@ -140,7 +140,7 @@
- deploy_dss_minio

- name: Start DSS Software
import_playbook: start_dss_software.yml
ansible.builtin.import_playbook: start_dss_software.yml

- name: Deploy Data Mover
import_playbook: deploy_client.yml
ansible.builtin.import_playbook: deploy_client.yml
4 changes: 2 additions & 2 deletions playbooks/format_redeploy_dss_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
- validate_ansible

- name: Remove DSS Software
import_playbook: remove_dss_software.yml
ansible.builtin.import_playbook: remove_dss_software.yml

- name: Format Disks
hosts:
Expand All @@ -54,6 +54,6 @@
- format_disks

- name: Deploy DSS Software
import_playbook: deploy_dss_software.yml
ansible.builtin.import_playbook: deploy_dss_software.yml
vars:
cleanup_minio: true
4 changes: 2 additions & 2 deletions playbooks/format_restart_dss_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
- validate_ansible

- name: Stop DSS Software
import_playbook: stop_dss_software.yml
ansible.builtin.import_playbook: stop_dss_software.yml

- name: Format Disks
hosts:
Expand All @@ -65,7 +65,7 @@
- remove_datamover_index

- name: Start DSS Software
import_playbook: start_dss_software.yml
ansible.builtin.import_playbook: start_dss_software.yml
vars:
cleanup_minio: true

Expand Down
2 changes: 1 addition & 1 deletion playbooks/redeploy_dss_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
- validate_ansible

- name: Remove DSS Software
import_playbook: remove_dss_software.yml
ansible.builtin.import_playbook: remove_dss_software.yml
vars:
remove_etc: false

Expand Down
4 changes: 2 additions & 2 deletions playbooks/remove_dss_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
- validate_ansible

- name: Stop datamover
import_playbook: cleanup_datamover.yml
ansible.builtin.import_playbook: cleanup_datamover.yml

- name: Stop DSS Software
import_playbook: stop_dss_software.yml
ansible.builtin.import_playbook: stop_dss_software.yml

- name: Reset SPDK
hosts:
Expand Down
2 changes: 1 addition & 1 deletion playbooks/remove_vlans.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
- validate_ansible

- name: Remove DSS Software
import_playbook: remove_dss_software.yml
ansible.builtin.import_playbook: remove_dss_software.yml

- name: Get Onyx LLDP tables
hosts: onyx
Expand Down
4 changes: 2 additions & 2 deletions playbooks/restart_dss_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
- validate_ansible

- name: Stop DSS Software
import_playbook: stop_dss_software.yml
ansible.builtin.import_playbook: stop_dss_software.yml

- name: Start DSS Software
import_playbook: start_dss_software.yml
ansible.builtin.import_playbook: start_dss_software.yml
2 changes: 1 addition & 1 deletion playbooks/stop_reset_dss_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# Additionally, once DSS software is stopped, disks will be returned back to kernel mode (SPDK reset).

- name: Stop DSS Software
import_playbook: stop_dss_software.yml
ansible.builtin.import_playbook: stop_dss_software.yml

- name: Reset SPDK
hosts:
Expand Down
4 changes: 2 additions & 2 deletions playbooks/upgrade_dss_software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
- validate_ansible

- name: Stop DSS Software and Reset SPDK
import_playbook: stop_reset_dss_software.yml
ansible.builtin.import_playbook: stop_reset_dss_software.yml

- name: Deploy DSS Software
import_playbook: deploy_dss_software.yml
ansible.builtin.import_playbook: deploy_dss_software.yml
4 changes: 2 additions & 2 deletions roles/check_iommu_off/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
---

- name: Find IOMMU groups
find:
ansible.builtin.find:
path: /sys/kernel/iommu_groups
file_type: directory
recurse: false
register: iommu_groups

- name: Assert IOMMU off
assert:
ansible.builtin.assert:
that: iommu_groups.matched == 0
msg: IOMMU is enabled. Please disable IOMMU to use DSS software.
4 changes: 2 additions & 2 deletions roles/check_minio_errors/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
---

- name: Check minio logs for errors
shell: >
ansible.builtin.shell: >
grep -i error {{ dss_log_dir }}/nkv-minio*.log
{%- for error in exclude_errors_list -%}
| grep -v '{{ error }}'
Expand All @@ -40,7 +40,7 @@
register: minio_errors

- name: Assert minio errors not found
assert:
ansible.builtin.assert:
that: minio_errors.stdout_lines | length == 0
msg: "{{ minio_errors.stdout }}"
ignore_errors: true
6 changes: 3 additions & 3 deletions roles/check_minio_up/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---

- name: pgrep minio instances
command: pgrep -x minio
- name: Search for minio instances with pgrep
ansible.builtin.command: pgrep -x minio
changed_when: false
failed_when: false
register: minio_instances

- name: Print number of minio instances running
debug:
ansible.builtin.debug:
msg: "Minio instances running: {{ minio_instances.stdout_lines | length }}"
4 changes: 2 additions & 2 deletions roles/check_target_errors/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
---

- name: Check target logs for errors
shell: >
ansible.builtin.shell: >
grep -i error {{ dss_log_dir }}/nkv-target.log
{%- for error in exclude_errors_list -%}
| grep -v '{{ error }}'
Expand All @@ -40,7 +40,7 @@
register: target_errors

- name: Assert target errors not found
assert:
ansible.builtin.assert:
that: target_errors.stdout_lines | length == 0
msg: "{{ target_errors.stdout }}"
ignore_errors: true
6 changes: 3 additions & 3 deletions roles/check_target_up/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---

- name: pgrep target instances
command: pgrep reactor_
- name: Search for target instances with pgrep
ansible.builtin.command: pgrep reactor_
changed_when: false
failed_when: false
register: target_instances

- name: Print number of target instances running
debug:
ansible.builtin.debug:
msg: "Target instances running: {{ target_instances.stdout_lines | length }}"
6 changes: 3 additions & 3 deletions roles/cleanup_datamover/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
---

- name: Get PIDs of datamover processes
command: "pgrep -f 'python3 {{ item }}'"
ansible.builtin.command: "pgrep -f 'python3 {{ item }}'"
register: datamover_pids
changed_when: false
failed_when: false
Expand All @@ -41,14 +41,14 @@
- client_application.py

- name: Get SIDs of datamover processes
command: "ps -p {{ item }} -o sess="
ansible.builtin.command: "ps -p {{ item }} -o sess="
register: datamover_sids
changed_when: false
failed_when: false
loop: "{{ datamover_pids.results | map(attribute='stdout_lines') | flatten | unique }}"

- name: Kill datamover processes and sub-processes
command: "pkill -s {{ item }}"
ansible.builtin.command: "pkill -s {{ item }}"
loop: "{{ datamover_sids.results | map(attribute='stdout_lines') | flatten | unique }}"
register: pkill_sid
become: true
Expand Down
16 changes: 8 additions & 8 deletions roles/cleanup_dss_minio/tasks/check_subsystems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
---

- name: Init vars
set_fact:
ansible.builtin.set_fact:
included_targets: []
combined_expected_num_subsystems: 0

- name: Set included_targets var
set_fact:
ansible.builtin.set_fact:
included_targets: "{{ included_targets + [ target ] }}"
loop: "{{ target_hostnames }}"
loop_control:
Expand All @@ -44,19 +44,19 @@
run_once: true

- name: Check number of listeners in nvmf.in.conf
shell: |
ansible.builtin.shell: |
grep '^ Listen RDMA' {{ target_conf_file }} | wc -l
changed_when: false
register: num_listeners
when: inventory_hostname in included_targets

- name: Set expected_num_subsystems var
set_fact:
ansible.builtin.set_fact:
expected_num_subsystems: "{{ num_listeners.stdout }}"
when: inventory_hostname in included_targets

- name: Set combined_expected_num_subsystems var
set_fact:
ansible.builtin.set_fact:
combined_expected_num_subsystems: "{{ combined_expected_num_subsystems | int + hostvars[host].expected_num_subsystems | int }}"
loop: "{{ included_targets }}"
loop_control:
Expand All @@ -65,7 +65,7 @@
run_once: true

- name: NVMe list subsystems
command: nvme list-subsys
ansible.builtin.command: nvme list-subsys
environment:
PATH: "{{ ansible_env.PATH }}:/sbin:/usr/sbin"
changed_when: false
Expand All @@ -74,14 +74,14 @@
when: inventory_hostname in host_hostnames

- name: Check number of mounted subsystems
set_fact:
ansible.builtin.set_fact:
subsystems_found: "{{ nvme_subsys.stdout | regex_findall(nvme_re) | length }}"
vars:
nvme_re: 'traddr=[^\s]+\strsvcid=[^\s]+\slive'
when: inventory_hostname in host_hostnames

- name: Assert subsystems mounted
assert:
ansible.builtin.assert:
that: subsystems_found == combined_expected_num_subsystems
msg: >
Subsystems are not mounted. Cannot cleanup MinIO unless DSS software is started.
Expand Down
16 changes: 8 additions & 8 deletions roles/cleanup_dss_minio/tasks/cleanup_minio.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
---

- name: Init vars
set_fact:
ansible.builtin.set_fact:
target_hostnames: "{{ (groups['servers'] | d([]) + groups['targets'] | d([])) | unique }}"
host_hostnames: "{{ (groups['servers'] | d([]) + groups['hosts'] | d([])) | unique }}"

- name: Get all RoCEv2 IP Addresses
include_role:
ansible.builtin.include_role:
name: get_vlan_ips
vars:
vlan_list: "{{ rocev2_vlans }}"
when: rocev2_ip_list is not defined

- name: Set rocev2_ip_list var if IP's auto-discovered
set_fact:
ansible.builtin.set_fact:
rocev2_ip_list: "{{ vlan_ip_list }}"
when: rocev2_ip_list is not defined

- name: Set rocev2_alias_map var
set_fact:
ansible.builtin.set_fact:
rocev2_alias_map: "{{ rocev2_alias_map | d([]) }} +
[
{
Expand All @@ -34,14 +34,14 @@
when: inventory_hostname in host_hostnames

- name: Read local DSS conf
command: "cat {{ target_conf_dir }}/client_library_conf.json"
ansible.builtin.command: "cat {{ target_conf_dir }}/client_library_conf.json"
register: local_dss_conf
run_once: true
delegate_to: "{{ host_hostnames[0] }}"
changed_when: false

- name: Set cluster_num_list var
set_fact:
ansible.builtin.set_fact:
cluster_num_list: "{{ cluster_num_list | default([]) }} +
[
{% for host in ansible_play_hosts %}
Expand All @@ -52,14 +52,14 @@
run_once: true

- name: Check subsystems are mounted
include_tasks: check_subsystems.yml
ansible.builtin.include_tasks: check_subsystems.yml
loop: "{{ cluster_num_list | unique }}"
loop_control:
loop_var: current_cluster_num
when: current_cluster_num | string == cluster_num | string

- name: Cleanup MinIO
include_tasks: execute_cleanup_script.yml
ansible.builtin.include_tasks: execute_cleanup_script.yml
loop: "{{ (local_dss_conf.stdout | from_json).clusters }}"
loop_control:
label: "{{ first_endpoint }}"
Expand Down
6 changes: 3 additions & 3 deletions roles/cleanup_dss_minio/tasks/execute_cleanup_script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@
---

- name: Get range of mountpoints
command: >-
ansible.builtin.command: >-
grep -oP "mount_point\"\: \"/dev/nvme\K\d+" nkv_config_{{ rocev2_ip }}.json
register: mountpoint_range
args:
chdir: "{{ nkv_sdk_conf_dir }}"
changed_when: false

- name: Set min_mountpoint and max_mountpoint vars
set_fact:
ansible.builtin.set_fact:
min_mountpoint: "{{ mountpoint_range.stdout_lines[0] }}"
max_mountpoint: "{{ mountpoint_range.stdout_lines[-1] }}"

- name: Execute minio_cleanup.sh
command: "sh ./minio_cleanup.sh {{ min_mountpoint }} {{ max_mountpoint }} nkv_config_{{ rocev2_ip }}.json"
ansible.builtin.command: "sh ./minio_cleanup.sh {{ min_mountpoint }} {{ max_mountpoint }} nkv_config_{{ rocev2_ip }}.json"
args:
chdir: "{{ nkv_sdk_bin_dir }}"
become: true
Expand Down
Loading

0 comments on commit c60d819

Please sign in to comment.