import_scp.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. # Copyright 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Remove the SCP file if exists
  16. file:
  17. path: "{{ role_path }}/files/{{ scp_filename }}"
  18. state: absent
  19. run_once: true
  20. - name: Create SCP file
  21. copy:
  22. src: "{{ role_path }}/files/temp_scp.xml"
  23. dest: "{{ role_path }}/files/{{ scp_filename }}"
  24. mode: preserve
  25. run_once: true
  26. - name: Add system profile value to SCP file
  27. lineinfile:
  28. path: "{{ role_path }}/files/{{ scp_filename }}"
  29. line: "{{ item.line }}"
  30. insertafter: '^(.*)BootSeqRetry'
  31. when: idrac_system_profile == item.name
  32. with_items:
  33. - { name: "Performance", line: " <Attribute Name=\"SysProfile\">PerfOptimized</Attribute>" }
  34. - { name: "PerformancePerWatt(OS)", line: " <Attribute Name=\"SysProfile\">PerfPerWattOptimizedOs</Attribute>" }
  35. - { name: "PerformancePerWatt(DAPC)", line: " <Attribute Name=\"SysProfile\">PerfPerWattOptimizedDapc</Attribute>" }
  36. - { name: "WorkstationPerformance", line: " <Attribute Name=\"SysProfile\">PerfWorkStationOptimized</Attribute>" }
  37. run_once: true
  38. - name: Add PXE attributes to SCP file
  39. lineinfile:
  40. path: "{{ role_path }}/files/{{ scp_filename }}"
  41. line: "{{ item }}"
  42. insertafter: '^(.*)SysProfile'
  43. with_items:
  44. - ' <Attribute Name="PxeDev1VlanPriority">0</Attribute>'
  45. - ' <Attribute Name="PxeDev1Interface">NIC.Integrated.1-1-1</Attribute>'
  46. - ' <Attribute Name="PxeDev1VlanId">1</Attribute>'
  47. - ' <Attribute Name="PxeDev1VlanEnDis">Enabled</Attribute>'
  48. - ' <Attribute Name="PxeDev1Protocol">IPv4</Attribute>'
  49. - ' <Attribute Name="PxeDev1EnDis">Enabled</Attribute>'
  50. when: not (enterprise_license or datacenter_license)
  51. run_once: true
  52. - name: Disable PXE attributes to SCP file
  53. lineinfile:
  54. path: "{{ role_path }}/files/{{ scp_filename }}"
  55. line: ' <Attribute Name="PxeDev1EnDis">Disabled</Attribute>'
  56. insertafter: '^(.*)SysProfile'
  57. when: enterprise_license or datacenter_license
  58. run_once: true
  59. - name: Add SNMP community name attribute to SCP file
  60. lineinfile:
  61. path: "{{ role_path }}/files/{{ scp_filename }}"
  62. line: ' <Attribute Name="SNMP.1#AgentCommunity">{{ snmp_community_name }}</Attribute>'
  63. insertafter: '^(.*)SNMP.1#AgentEnable'
  64. run_once: true
  65. - name: Add SNMP trap destination attributes to SCP file
  66. lineinfile:
  67. path: "{{ role_path }}/files/{{ scp_filename }}"
  68. line: "{{ item }}"
  69. insertafter: '^(.*)SNMP.1#AlertPort'
  70. with_items:
  71. - ' <Attribute Name="SNMPAlert.1#Destination">{{ snmp_trap_destination }}</Attribute>'
  72. - ' <Attribute Name="SNMPAlert.1#State">Enabled</Attribute>'
  73. when: snmp_trap_status
  74. run_once: true
  75. - name: Import SCP from a local path and wait for this job to get completed
  76. dellemc.openmanage.idrac_server_config_profile:
  77. idrac_ip: "{{ inventory_hostname }}"
  78. idrac_user: "{{ idrac_username }}"
  79. idrac_password: "{{ idrac_password }}"
  80. share_name: "{{ role_path }}/files/"
  81. command: "import"
  82. scp_file: "{{ scp_filename }}"
  83. scp_components: "ALL"
  84. shutdown_type: "Graceful"
  85. job_wait: "True"
  86. register: import_scp_status
  87. - name: Remove the SCP file
  88. file:
  89. path: "{{ role_path }}/files/{{ scp_filename }}"
  90. state: absent
  91. run_once: true