Skip to content

Commit

Permalink
Merge pull request #202 from HewlettPackard/automation
Browse files Browse the repository at this point in the history
Automation
  • Loading branch information
nabhajit-ray authored Jul 18, 2022
2 parents 8c3e793 + dd63b3a commit 255e4f7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
sessionID: "{{ session.ansible_facts.session }}"
uri: "{{ appliance_device_snmp_v3_trap_destinations['uri'] }}"
delegate_to: localhost
when: appliance_device_snmp_v3_trap_destinations is True
when: appliance_device_snmp_v3_trap_destinations is defined

- debug:
var: appliance_device_snmp_v3_trap_destinations
8 changes: 4 additions & 4 deletions roles/oneview_enclosure_facts/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
oneview_enclosure_facts:
config: "{{ config }}"
sessionID: "{{ session.ansible_facts.session }}"
name: "{{ contents.enclosure.name }}"
name: "{{ contents.enclosure.enclosure_name }}"
delegate_to: localhost

- debug: var=enclosures
Expand All @@ -60,16 +60,16 @@
oneview_enclosure_facts:
config: "{{ config }}"
sessionID: "{{ session.ansible_facts.session }}"
name: "{{ contents.enclosure.name }}"
name: "{{ contents.enclosure.enclosure_name }}"
options:
- script
when: contents.variant == 'C7000' or currentVersion == '300'
when: contents.enclosure.variant == 'C7000' or currentVersion == '300'
delegate_to: localhost

- name: Gather facts about an Enclosure by name with options
oneview_enclosure_facts:
config: "{{ config }}"
name: "{{ contents.enclosure.name }}"
name: "{{ contents.enclosure.enclosure_name }}"
sessionID: "{{ session.ansible_facts.session }}"
options:
- environmentalConfiguration # optional
Expand Down
2 changes: 1 addition & 1 deletion roles/oneview_server_hardware/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
# defaults file for oneview_server_hardware
config: "~/.ansible/collections/ansible_collections/hpe/oneview/roles/oneview_server_hardware/files/oneview_config.json"
contents: "{{lookup('file', config)}}"
contents: "{{lookup('file', '../config/config.json') | from_json}}"
10 changes: 5 additions & 5 deletions roles/oneview_server_hardware/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
initialScopeUris:
- "{{ scopes[0]['uri'] }}" #Supported only with OneView API version >= 600.
delegate_to: localhost
when: variant == 'C7000'
when: contents.server_hardware.variant == 'C7000'

- name: Do nothing when the server hardware is already present
oneview_server_hardware:
Expand All @@ -44,7 +44,7 @@
licensingIntent: "OneView"
configurationState: "Managed"
delegate_to: localhost
when: variant == 'C7000'
when: contents.server_hardware.variant == 'C7000'

#This task available only with OneView API version >= 600.
- name: Add multiple rack-mount servers
Expand All @@ -61,7 +61,7 @@
licensingIntent: "OneView"
configurationState: "Managed"
delegate_to: localhost
when: variant == 'C7000'
when: contents.server_hardware.variant == 'C7000'

- name: Gather facts about all Server Hardwares
oneview_server_hardware_facts:
Expand Down Expand Up @@ -189,7 +189,7 @@
data:
name: "{{ contents.server_hardware.server_hardware_hostname }}"
delegate_to: localhost
when: variant == 'C7000'
when: contents.server_hardware.variant == 'C7000'

- name: Do nothing when the server hardware is already removed
oneview_server_hardware:
Expand All @@ -199,4 +199,4 @@
data:
name: "{{ contents.server_hardware.server_hardware_hostname }}"
delegate_to: localhost
when: variant == 'C7000'
when: contents.server_hardware.variant == 'C7000'
11 changes: 0 additions & 11 deletions roles/oneview_user/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,6 @@
newPassword: "{{ contents.users.newpassword }}"
delegate_to: localhost

- name: Change the User's password during first-time setup
oneview_user:
config: "{{ config }}"
sessionID: "{{ session.ansible_facts.session }}"
state: set_password
data:
userName: "{{ contents.users.user_name }}"
oldPassword: "myPass1234"
newPassword: "{{ contents.users.newPassword }}"
delegate_to: localhost

- name: Adds multiple new local users to the appliance
oneview_user:
config: "{{ config }}"
Expand Down

0 comments on commit 255e4f7

Please sign in to comment.