12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- ---
- - name: Install paramiko
- command: pip3 install paramiko -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
- delegate_to: localhost
- run_once: true
- changed_when: false
- - name: Check if ethernet_tor_vars.yml exists
- stat:
- path: "{{ tor_config_file }}"
- register: stat_result
- - name: Fail if config file doesn't exist
- fail:
- msg: "{{ fail_msg_tor_config_file }}"
- when: not stat_result.stat.exists
- - name: Check if ethernet_vars.yml exists
- stat:
- path: "{{ config_file }}"
- register: stat_result
- - name: Fail if config file doesn't exist
- fail:
- msg: "{{ fail_msg_config_file }}"
- when: not stat_result.stat.exists
- - name: Check switch model name
- dellos10_command:
- commands: 'show system | grep "Current Type"'
- register: model_type
- - name: Save switch model name
- set_fact:
- model_type: "{{ model_type.stdout[0].split(' ')[-1] }}"
- - name: Pre-requisite tasks for S3* and S4* switches
- block:
- - name: Include ethernet_tor_vars.yml config variable file
- include_vars: "{{ tor_config_file }}"
- - name: Assert save_changes_to_startup variable
- assert:
- that: "save_changes_to_startup == true or save_changes_to_startup == false"
- success_msg: "{{ success_msg_tor_save_config }}"
- fail_msg: "{{ fail_msg_tor_save_config }}"
- when: "'S3' in model_type or 'S4' in model_type"
- - name: Pre-requisite tasks for other ethernet switches
- block:
- - name: Include ethernet_vars.yml config variable file
- include_vars: "{{ config_file }}"
- - name: Assert save_changes_to_startup variable
- assert:
- that: "save_changes_to_startup == true or save_changes_to_startup == false"
- success_msg: "{{ success_msg_save_config }}"
- fail_msg: "{{ fail_msg_save_config }}"
- when: "'S3' not in model_type and 'S4' not in model_type"
|