Skip to content

Commit

Permalink
Merge pull request #15 in ESSOL-BB/ansible-santricity from swartzn_ES…
Browse files Browse the repository at this point in the history
…OLA-171_fix_unquoted_eseries_system_serial to master

* commit 'd20f7d626870952b7d83640c8b7e5611dad9c2d4':
  Fix issue with unquoted eseries_system_serial
  • Loading branch information
swartzn committed Apr 7, 2022
2 parents a16d2b3 + d20f7d6 commit 80147b3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Example Storage System Inventory File (Discover storage system)
-------------------------------------
**Note that this discovery method works for SANtricity versions 11.62 or later, otherwise it will only discover the systems with unset passwords.**

eseries_system_serial: "012345678901" # Be sure to quote if the serial is all numbers and begins with zero.
eseries_system_serial: 012345678901
eseries_system_password: admin_password
eseries_subnet: 192.168.1.0/24

Expand All @@ -163,7 +163,7 @@ Example Storage System Inventory File (Discover storage system)

Example Storage System Inventory File (Discover storage system with proxy)
-------------------------------------
eseries_system_serial: "012345678901" # Be sure to quote if the serial is all numbers and begins with zero.
eseries_system_serial: 012345678901
eseries_system_password: admin_password

eseries_proxy_api_url: https://192.168.1.100:8443/devmgr/v2/
Expand Down Expand Up @@ -308,8 +308,7 @@ Collection Variables

# Storage system specific variables
eseries_proxy_ssid: # Arbitrary string for the proxy to represent the storage system. eseries_system_serial will be used when not defined.
eseries_system_serial: # Storage system serial number. Be sure to quote if the serial is all numbers and begins with zero. (This is located on a
# label at the top-left towards the front on the device)
eseries_system_serial: # Storage system serial number. (This is located on a label at the top-left towards the front on the device)
eseries_system_addresses: # Storage system management IP addresses. Only required when eseries_system_serial or eseries_system_api_url are not
# defined. When not specified, addresses will be populated with eseries_management_interfaces controller addresses.
eseries_system_api_url: # Url for the storage system's for embedded web services rest api. Example: https://192.168.10.100/devmgr/v2
Expand Down
6 changes: 3 additions & 3 deletions roles/nar_santricity_common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Example Inventory Host file using discovery with proxy
eseries_proxy_api_url: https://192.168.1.100:8443/devmgr/v2/
eseries_proxy_api_password: admin_password
eseries_subnet: 192.168.1.0/24 # This should only be defined at the group level once when utilizing Web Services Proxy and should be broad enough to include all systems being added to proxy instance.
eseries_system_serial: "012345678901" # Be sure to quote if the serial is all numbers and begins with zero.
eseries_system_serial: 012345678901
eseries_system_password: admin_password
eseries_validate_certs: false
(...)
Expand All @@ -44,7 +44,7 @@ Example Inventory Host file using discovery without proxy
---------------------------------------------------------
**Note that while eseries_management_interfaces or eseries_system_api_url are optional, including at least one of them will prevent the discovery mechanism from being used when the system can be reached from their information.
eseries_subnet: 192.168.1.0/24
eseries_system_serial: "012345678901" # Be sure to quote if the serial is all numbers and begins with zero.
eseries_system_serial: 012345678901
eseries_system_password: admin_password
eseries_validate_certs: false
(...)
Expand Down Expand Up @@ -81,7 +81,7 @@ Role Variables

# Storage system specific variables
eseries_proxy_ssid: # Arbitrary string for the proxy to represent the storage system. eseries_system_serial will be used when not defined.
eseries_system_serial: # Storage system serial number. Be sure to quote if the serial is all numbers and begins with zero. (This is located on a label at the top-left towards the front on the device)
eseries_system_serial: # Storage system serial number. (This is located on a label at the top-left towards the front on the device)
eseries_system_addresses: # Storage system management IP addresses. Only required when eseries_system_serial or eseries_system_api_url are not defined. When not specified, addresses will be populated with eseries_management_interfaces controller addresses.
eseries_system_api_url: # Url for the storage system's for embedded web services rest api. Example: https://192.168.10.100/devmgr/v2
eseries_system_username: admin # Username for the storage system's for embedded web services rest api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
prefer_embedded: "{{ item['value']['prefer_embedded'] }}"
run_once: true
connection: local
no_log: true
register: discovered_systems
loop: "{{ subnets | dict2items }}"
tags: always
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@
- name: Determine storage system Web Services information
set_fact:
current_eseries_api_info: |-
{% set info = {} %}
{%- for result in discovered_systems["results"] -%}
{%- for serial in (result["systems_found"].keys() | list) if eseries_system_serial and serial == eseries_system_serial -%}
{%- if info.update(result["systems_found"][serial]) %}{%- endif -%}
{%- set info = {} -%}
{%- if eseries_system_serial is defined -%}
{%- set serial = eseries_system_serial | string -%}
{%- for result in discovered_systems["results"] if result["systems_found"][serial] is defined -%}
{%- if info.update(result["systems_found"][serial]) %}{%- endif -%}
{%- endfor %}
{%- endfor %}
{%- endif -%}
{{ info }}
no_log: true
- name: Check whether storage system was discovered.
fail:
Expand Down
12 changes: 6 additions & 6 deletions roles/nar_santricity_common/tasks/collect_facts/prefer_proxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,14 @@
- name: Determine storage system Web Services information
set_fact:
current_eseries_api_info: |-
{% set info = {} %}
{%- for result in discovered_systems["results"] -%}
{%- for serial in (result["systems_found"].keys() | list) if eseries_system_serial and serial == eseries_system_serial -%}
{%- if info.update(result["systems_found"][serial]) %}{%- endif -%}
{%- set info = {} -%}
{%- if eseries_system_serial is defined -%}
{%- set serial = eseries_system_serial | string -%}
{%- for result in discovered_systems["results"] if result["systems_found"][serial] is defined -%}
{%- if info.update(result["systems_found"][serial]) %}{%- endif -%}
{%- endfor %}
{%- endfor %}
{%- endif -%}
{{ info }}
no_log: true
- name: Check whether storage system was discovered.
fail:
Expand Down

0 comments on commit 80147b3

Please sign in to comment.