Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve binary check and tested against omada 5.12.7 #11

Merged
merged 3 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading