# 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: Remove the SCP file if exists file: path: "{{ role_path }}/files/{{ scp_filename }}" state: absent run_once: true - name: Create SCP file copy: src: "{{ role_path }}/files/temp_scp.xml" dest: "{{ role_path }}/files/{{ scp_filename }}" mode: preserve run_once: true - name: Add system profile value to SCP file lineinfile: path: "{{ role_path }}/files/{{ scp_filename }}" line: "{{ item.line }}" insertafter: '^(.*)BootSeqRetry' when: idrac_system_profile == item.name with_items: - { name: "Performance", line: " PerfOptimized" } - { name: "PerformancePerWatt(OS)", line: " PerfPerWattOptimizedOs" } - { name: "PerformancePerWatt(DAPC)", line: " PerfPerWattOptimizedDapc" } - { name: "WorkstationPerformance", line: " PerfWorkStationOptimized" } run_once: true - name: Add PXE attributes to SCP file lineinfile: path: "{{ role_path }}/files/{{ scp_filename }}" line: "{{ item }}" insertafter: '^(.*)SysProfile' with_items: - ' Enabled' - ' Enabled' - ' Enabled' - ' Enabled' - ' Disabled' - ' Disabled' - ' Disabled' - ' Disabled' when: provision_method == provision_method_pxe run_once: true - name: Disable PXE attributes to SCP file lineinfile: path: "{{ role_path }}/files/{{ scp_filename }}" line: "{{ item }}" insertafter: '^(.*)SysProfile' with_items: - ' Disabled' - ' Disabled' - ' Disabled' - ' Disabled' when: provision_method == provision_method_idrac run_once: true - name: Add SNMP community name attribute to SCP file lineinfile: path: "{{ role_path }}/files/{{ scp_filename }}" line: ' {{ snmp_community_name }}' insertafter: '^(.*)SNMP.1#AgentEnable' run_once: true - name: Add SNMP trap destination attributes to SCP file lineinfile: path: "{{ role_path }}/files/{{ scp_filename }}" line: "{{ item }}" insertafter: '^(.*)SNMP.1#AlertPort' with_items: - ' {{ snmp_trap_destination }}' - ' Enabled' when: snmp_trap_status run_once: true - block: - name: Import SCP from a local path and wait for this job to get completed dellemc.openmanage.idrac_server_config_profile: idrac_ip: "{{ inventory_hostname }}" idrac_user: "{{ idrac_username }}" idrac_password: "{{ idrac_password }}" share_name: "{{ role_path }}/files/" command: "import" scp_file: "{{ scp_filename }}" scp_components: "ALL" shutdown_type: "Forced" job_wait: "True" register: import_scp_status until: not import_scp_status.failed retries: "{{ retries_count }}" rescue: - name: Import SCP failed fail: msg: "{{ import_scp_fail_msg }}" - name: Remove the SCP file file: path: "{{ role_path }}/files/{{ scp_filename }}" state: absent run_once: true