# Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. --- - name: Include variable file idrac_vars.yml include_vars: "{{ idrac_input_filename }}" run_once: true - name: Include variable file base_vars.yml include_vars: "{{ base_input_filename }}" run_once: true - name: Initialize variables set_fact: snmp_trap_status: false provision_status: false run_once: true - name: Validate input parameters are not empty fail: msg: "{{ idrac_input_fail_msg }}" register: idrac_config_check when: - idrac_system_profile | length < 1 - name: Assert idrac_system_profile value assert: that: - idrac_system_profile == "Performance" or idrac_system_profile == "PerformancePerWatt(DAPC)" or idrac_system_profile == "PerformancePerWatt(OS)" or idrac_system_profile == "WorkstationPerformance" success_msg: "{{ idrac_system_profile_success_msg }}" fail_msg: "{{ idrac_system_profile_fail_msg }}" - name: Assert firmware_update_required value assert: that: - firmware_update_required == true or firmware_update_required == false success_msg: "{{ firmware_update_success_msg }}" fail_msg: "{{ firmware_update_fail_msg }}" - name: Assert snmp_community_name value assert: that: - snmp_community_name | length > 1 success_msg: "{{ snmp_community_success_msg }}" fail_msg: "{{ snmp_community_fail_msg }}" - name: Set snmp trap destination status set_fact: snmp_trap_status: true when: snmp_trap_destination | length > 1 run_once: true - name: Assert snmp_trap_destination value assert: that: - snmp_trap_destination | length > 6 success_msg: "{{ snmp_trap_dest_success_msg }}" fail_msg: "{{ snmp_trap_dest_fail_msg }}" when: snmp_trap_status - name: Check hostname command: hostname changed_when: false register: hostname run_once: true - name: Fetch idrac credentials include_tasks: fetch_idrac_credentials.yml when: awx_search_key not in hostname.stdout - name: Set idrac credentials set_fact: idrac_username: "{{ lookup('env','ANSIBLE_NET_USERNAME') }}" idrac_password: "{{ lookup('env','ANSIBLE_NET_PASSWORD') }}" no_log: true when: awx_search_key in hostname.stdout run_once: true