Updating MikroTik RouterOS Devices using Ansible (both CHR and RB)
- Updating RouterOS using Ansible
- Tested on Ansible 2.9.1
- RouterOS version not lower than 6.45 due to the use of sftp to transfer files
- Just start playbook RouterOS-Update.yml
- Playbooks BackupRouterOS.yml, UpdateRouterOS-RB.yml, UpdateRouterOS-CHR.yml are needed for work
- I use ssh keys for authentication in example (and strictly recommend it)
- Before using, check the RouterOS latest version and type it in RouterOS-Update.yml playbook in three places (strings № 7, 40, 46)
General Steps:
- Doing export and backup files of RouterOS
- Copying these files to "bk" folder
- Checking and Printing if it's CHR or RB
- Checking and Printing RouterOS Version (both CHR and RB)
- Updating CHR RouterOS, if needed (when current RouterOS version != {{ version }})
- Updating RB RouterOS + RB Firmware, if needed (when current RouterOS version != {{ version }})
- Checking and Printing RouterOS Version after Updating (both CHR and RB)
- Checking and Printing Firmware Version after Updating (refers to RB only)
- Some cleaning on every steps
Due to scripting (delays and pauses) durations of RB and CHR updating are 6 min 25 sec and 2 min 15 sec respectively
- Just enjoy!