Skip to content

Commit

Permalink
improve binary check and tested against omada 5.12.7 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
trfore authored Apr 1, 2024
2 parents 91a9f92 + ea64a51 commit 6666680
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# https://www.tp-link.com/us/support/download/omada-software-controller/
omada_tar_src: https://static.tp-link.com/upload/software/2023/202303/20230321/Omada_SDN_Controller_v5.9.31_Linux_x64.tar.gz
omada_tar_src: https://static.tp-link.com/upload/software/2023/202309/20230920/Omada_SDN_Controller_v5.12.7_linux_x64.tar.gz
omada_tar_src_remote: true
omada_tar_dir: /var/tmp
omada_tar_folder: "{{ omada_tar_src | basename | splitext | first | splitext | first }}"
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ scenario:
- syntax
- create
- converge
# - idempotence
- idempotence
- verify
- destroy
2 changes: 1 addition & 1 deletion omada.url
Original file line number Diff line number Diff line change
@@ -1 +1 @@
https://static.tp-link.com/upload/software/2023/202303/20230321/Omada_SDN_Controller_v5.9.31_Linux_x64.tar.gz
https://static.tp-link.com/upload/software/2023/202309/20230920/Omada_SDN_Controller_v5.12.7_linux_x64.tar.gz
16 changes: 7 additions & 9 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,30 @@
tags: jsvc

- name: Check for jsvc binary
ansible.builtin.command: which jsvc
ignore_errors: true
ansible.builtin.stat:
path: /usr/bin/jsvc
register: jsvc_binary
changed_when: jsvc_binary.rc
tags: jsvc

- name: Error when jsvc is missing
ansible.builtin.fail:
msg: 'Error: jsvc is not present, Omada SDN requires jsvc'
when:
- "'jsvc' not in ansible_facts.packages"
- jsvc_binary.rc != 0
- not jsvc_binary.stat.exists
tags: jsvc

- name: Check for omada binary
ansible.builtin.command: which tpeap
ignore_errors: true
ansible.builtin.stat:
path: /usr/bin/tpeap
register: omada_binary
changed_when: omada_binary.rc

- name: Create a temporary directory for omada tar file
ansible.builtin.file:
path: '{{ omada_tar_dir }}/{{ omada_tar_folder }}'
state: directory
mode: '0775'
when: omada_binary.rc != 0
when: not omada_binary.stat.exists
register: omada_temp_dir

- name: Download and extract omada software
Expand All @@ -71,7 +69,7 @@
extra_opts:
- --strip-components=1
register: omada_tar
when: omada_binary.rc != 0
when: not omada_binary.stat.exists

- name: Run omada install script
become: true
Expand Down

0 comments on commit 6666680

Please sign in to comment.