pre_requisites.yml 2.4 KB

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