Role Variables - phillipyosief/alcatel-omniswitch-software-update GitHub Wiki

Role Variables

This page documents all variables available in the Alcatel OmniSwitch Software Update role.

Default Variables

These variables are defined in defaults/main.yml and can be overridden:

Authentication Variables

Variable Default Description
omniswitch_username "admin" SSH username for switch access
omniswitch_password "switch" SSH password for switch access

Example:

omniswitch_username: "netadmin"
omniswitch_password: "MySecurePassword123"

Path Variables

Variable Default Description
textfsm_folder "{{ role_path }}/textfsm" Path to TextFSM templates
versions_file "{{ role_path }}/files/versions.json" Path to versions configuration file

Example:

textfsm_folder: "/opt/textfsm-templates"
versions_file: "/var/ansible/switch-versions.json"

Timeout Variables

Variable Default Description
rollback_timeout 15 Rollback timeout in minutes
wait_for_timeout 300 Wait timeout in seconds (5 minutes)

Example:

rollback_timeout: 20        # 20 minutes for rollback
wait_for_timeout: 600       # 10 minutes wait timeout

Directory Variables

Variable Default Description
directory "working" Target directory for firmware updates

Options:

  • working - Update working directory (recommended)
  • running - Update running directory (risky)

Required Variables

These variables must be defined in your playbook:

File Variables

Variable Required Description
firmware_files Yes List of firmware files to upload
fpga_files No List of FPGA files to upload
uboot_files No List of U-Boot files to upload
backup_chassis_state_folder Yes Directory for chassis state backups

Example:

firmware_files:
  - "/path/to/OS6360_firmware_8.10.115.R01.img"
  - "/path/to/OS6850_firmware_6.4.4.743.R01.img"

fpga_files:
  - "/path/to/OS6360_fpga_0.8.img"

uboot_files:
  - "/path/to/OS6360_uboot_8.10.42.R02.img"

backup_chassis_state_folder: "/opt/backups/chassis-states"

Runtime Variables

These variables are set automatically during execution:

Device Information

Variable Description Example
release Detected AOS version "R6" or "R8"
model_name Switch model name "OS6360"
firmware_version Current firmware version "8.10.110.R01"
fpga_version Current FPGA version "0.7"
uboot_version Current U-Boot version "8.10.40.R01"

Version Comparison

Variable Description
new_firmware_version Target firmware version from JSON
new_fpga_version Target FPGA version from JSON
new_uboot_version Target U-Boot version from JSON

Update Flags

Variable Description
firmware_update_required true if firmware update needed
fpga_update_required true if FPGA update needed
uboot_update_required true if U-Boot update needed

Safety Checks

Variable Description
is_switch_safe_to_update true if switch is safe to update
is_synchronized true if configuration is synchronized
is_chassis_different true if chassis state changed

Advanced Variables

Custom SSH Settings

# Custom SSH port
ansible_port: 2022

# Custom timeout for SSH connections
ansible_timeout: 60

# Custom SSH options
ansible_ssh_common_args: '-o StrictHostKeyChecking=no'

Custom File Paths

# Custom TextFSM templates directory
textfsm_folder: "{{ playbook_dir }}/custom-templates"

# Custom versions file
versions_file: "{{ inventory_dir }}/switch-versions.json"

# Custom backup directory with timestamp
backup_chassis_state_folder: "/backups/{{ ansible_date_time.date }}"

Variable Precedence

Ansible variables have the following precedence (highest to lowest):

  1. Extra vars (-e command line)
  2. Task vars
  3. Block vars
  4. Role vars (vars/main.yml)
  5. Inventory vars
  6. Host vars
  7. Group vars
  8. Role defaults (defaults/main.yml)

Example Configurations

Basic Configuration

---
- hosts: alcatel_switches
  vars:
    # Authentication
    omniswitch_username: "admin"
    omniswitch_password: "MyPassword123"
    
    # Files
    firmware_files:
      - "{{ playbook_dir }}/firmware/firmware.img"
    backup_chassis_state_folder: "{{ playbook_dir }}/backups"
    
    # Timeouts
    wait_for_timeout: 600  # 10 minutes
    rollback_timeout: 20   # 20 minutes
    
  roles:
    - alcatel-omniswitch-software-update

Advanced Configuration

---
- hosts: alcatel_switches
  vars:
    # Authentication
    omniswitch_username: "netadmin"
    omniswitch_password: "{{ vault_switch_password }}"
    
    # Custom paths
    versions_file: "{{ inventory_dir }}/versions/production.json"
    backup_chassis_state_folder: "/opt/backups/{{ inventory_hostname }}"
    
    # Firmware files with dynamic paths
    firmware_files:
      - "{{ firmware_repo }}/{{ model_name }}/firmware.img"
    fpga_files:
      - "{{ firmware_repo }}/{{ model_name }}/fpga.img"
    uboot_files:
      - "{{ firmware_repo }}/{{ model_name }}/uboot.img"
    
    # Update control
    no_fpga_update: "{{ skip_fpga | default(false) }}"
    no_uboot_update: "{{ skip_uboot | default(false) }}"
    
    # Extended timeouts for large networks
    wait_for_timeout: 900    # 15 minutes
    rollback_timeout: 30     # 30 minutes
    
  roles:
    - alcatel-omniswitch-software-update

Environment-Specific Variables

Group Variables (group_vars/production.yml):

---
# Production environment settings
omniswitch_username: "prod-admin"
rollback_timeout: 30
wait_for_timeout: 900

# Production firmware repository
firmware_repo: "/opt/firmware/production"
versions_file: "{{ inventory_dir }}/versions/production.json"

Host Variables (host_vars/switch1.yml):

---
# Switch-specific overrides
rollback_timeout: 45  # This switch needs more time

# Custom firmware for this specific switch
firmware_files:
  - "/opt/firmware/custom/OS6360_custom_firmware.img"

Next Steps