pre_requisites.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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: Install paramiko
  16. command: pip3 install paramiko -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
  17. delegate_to: localhost
  18. run_once: true
  19. changed_when: false
  20. - name: Check if ethernet_tor_vars.yml exists
  21. stat:
  22. path: "{{ tor_config_file }}"
  23. register: stat_result
  24. - name: Fail if config file doesn't exist
  25. fail:
  26. msg: "{{ fail_msg_tor_config_file }}"
  27. when: not stat_result.stat.exists
  28. - name: Check if ethernet_vars.yml exists
  29. stat:
  30. path: "{{ config_file }}"
  31. register: stat_result
  32. - name: Fail if config file doesn't exist
  33. fail:
  34. msg: "{{ fail_msg_config_file }}"
  35. when: not stat_result.stat.exists
  36. - name: Check switch model name
  37. dellos10_command:
  38. commands: 'show system | grep "Current Type"'
  39. register: model_type
  40. - name: Save switch model name
  41. set_fact:
  42. model_type: "{{ model_type.stdout[0].split(' ')[-1] }}"
  43. - name: Pre-requisite tasks for S3* and S4* switches
  44. block:
  45. - name: Include ethernet_tor_vars.yml config variable file
  46. include_vars: "{{ tor_config_file }}"
  47. - name: Assert save_changes_to_startup variable
  48. assert:
  49. that: "save_changes_to_startup == true or save_changes_to_startup == false"
  50. success_msg: "{{ success_msg_tor_save_config }}"
  51. fail_msg: "{{ fail_msg_tor_save_config }}"
  52. when: "'S3' in model_type or 'S4' in model_type"
  53. - name: Pre-requisite tasks for other ethernet switches
  54. block:
  55. - name: Include ethernet_vars.yml config variable file
  56. include_vars: "{{ config_file }}"
  57. - name: Assert save_changes_to_startup variable
  58. assert:
  59. that: "save_changes_to_startup == true or save_changes_to_startup == false"
  60. success_msg: "{{ success_msg_save_config }}"
  61. fail_msg: "{{ fail_msg_save_config }}"
  62. when: "'S3' not in model_type and 'S4' not in model_type"