import_scp.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 Performance to scp file
  27. lineinfile:
  28. path: "{{ role_path }}/files/{{ scp_filename }}"
  29. line: ' <Attribute Name="SysProfile">PerfOptimized</Attribute>'
  30. insertafter: '^(.*)BootSeqRetry'
  31. when: idrac_system_profile == "Performance"
  32. run_once: true
  33. - name: Add system profile value PerformancePerWatt(OS) to scp file
  34. lineinfile:
  35. path: "{{ role_path }}/files/{{ scp_filename }}"
  36. line: ' <Attribute Name="SysProfile">PerfPerWattOptimizedOs</Attribute>'
  37. insertafter: '^(.*)BootSeqRetry'
  38. when: idrac_system_profile == "PerformancePerWatt(OS)"
  39. run_once: true
  40. - name: Add system profile value PerformancePerWatt(DAPC) to scp file
  41. lineinfile:
  42. path: "{{ role_path }}/files/{{ scp_filename }}"
  43. line: ' <Attribute Name="SysProfile">PerfPerWattOptimizedDapc</Attribute>'
  44. insertafter: '^(.*)BootSeqRetry'
  45. when: idrac_system_profile == "PerformancePerWatt(DAPC)"
  46. run_once: true
  47. - name: Add system profile value WorkstationPerformance to scp file
  48. lineinfile:
  49. path: "{{ role_path }}/files/{{ scp_filename }}"
  50. line: ' <Attribute Name="SysProfile">PerfWorkStationOptimized</Attribute>'
  51. insertafter: '^(.*)BootSeqRetry'
  52. when: idrac_system_profile == "WorkstationPerformance"
  53. run_once: true
  54. - name: Add PXE attributes to scp file
  55. lineinfile:
  56. path: "{{ role_path }}/files/{{ scp_filename }}"
  57. line: "{{ item }}"
  58. insertafter: '^(.*)SysProfile'
  59. with_items:
  60. - ' <Attribute Name="PxeDev1VlanPriority">0</Attribute>'
  61. - ' <Attribute Name="PxeDev1Interface">NIC.Integrated.1-1-1</Attribute>'
  62. - ' <Attribute Name="PxeDev1VlanId">1</Attribute>'
  63. - ' <Attribute Name="PxeDev1VlanEnDis">Enabled</Attribute>'
  64. - ' <Attribute Name="PxeDev1Protocol">IPv4</Attribute>'
  65. - ' <Attribute Name="PxeDev1EnDis">Enabled</Attribute>'
  66. when: not (enterprise_license or datacenter_license)
  67. run_once: true
  68. - name: Disable PXE attributes to scp file
  69. lineinfile:
  70. path: "{{ role_path }}/files/{{ scp_filename }}"
  71. line: ' <Attribute Name="PxeDev1EnDis">Disabled</Attribute>'
  72. insertafter: '^(.*)SysProfile'
  73. when: enterprise_license or datacenter_license
  74. run_once: true
  75. - name: Add SNMP community name attribute to scp file
  76. lineinfile:
  77. path: "{{ role_path }}/files/{{ scp_filename }}"
  78. line: ' <Attribute Name="SNMP.1#AgentCommunity">{{ snmp_community_name }}</Attribute>'
  79. insertafter: '^(.*)SNMP.1#AgentEnable'
  80. run_once: true
  81. - name: Add SNMP trap destination attributes to scp file
  82. lineinfile:
  83. path: "{{ role_path }}/files/{{ scp_filename }}"
  84. line: "{{ item }}"
  85. insertafter: '^(.*)SNMP.1#AlertPort'
  86. with_items:
  87. - ' <Attribute Name="SNMPAlert.1#Destination">{{ snmp_trap_destination }}</Attribute>'
  88. - ' <Attribute Name="SNMPAlert.1#State">Enabled</Attribute>'
  89. when: snmp_trap_status
  90. run_once: true
  91. - name: Import SCP from a local path and wait for this job to get completed
  92. dellemc.openmanage.idrac_server_config_profile:
  93. idrac_ip: "{{ inventory_hostname }}"
  94. idrac_user: "{{ idrac_username }}"
  95. idrac_password: "{{ idrac_password }}"
  96. share_name: "{{ role_path }}/files/"
  97. command: "import"
  98. scp_file: "{{ scp_filename }}"
  99. scp_components: "ALL"
  100. shutdown_type: "Graceful"
  101. job_wait: "True"
  102. register: import_scp_status
  103. - name: Remove the scp file
  104. file:
  105. path: "{{ role_path }}/files/{{ scp_filename }}"
  106. state: absent
  107. run_once: true