1
0
Fork 0
mirror of https://github.com/kasmtech/ansible.git synced 2026-01-23 02:25:25 +00:00

Merge branch 'feature/KASM-6335_add_support_for_offline_plugin_install' into 'develop'

KASM-6335 Add support forr offline network plugin install

Closes KASM-6335

See merge request kasm-technologies/internal/ansible!21
This commit is contained in:
Justin Travis 2024-08-12 20:04:36 +00:00
commit fcfcec7e6b
4 changed files with 51 additions and 2 deletions

View file

@ -64,7 +64,7 @@ It has been tested on CentOS 7.9.2009, CentOS 8.4.2105, Debian 9.13, Debian 10.1
3. Download the Kasm Workspaces installer from https://www.kasmweb.com/downloads.html and copy it to `roles/install_common/files`.
Optionally, if doing an offline installation: Download and copy the workspace_images and service_images files to `roles/install_common/files`.
Optionally, if doing an offline installation: Download and copy the workspace_images, service_images and network plugin files to `roles/install_common/files`.
4. Run the deployment.

View file

@ -19,6 +19,7 @@
--manager-token {{ manager_token }}
{{ '-s ' ~ service_images_copy.dest if service_images_file }}
{{ '-w ' ~ workspace_images_copy.dest if workspace_images_file }}
{{ '-x ' ~ network_plugin_copy.dest if network_plugin_file }}
register: install_output
become: true
retries: 20

View file

@ -3,6 +3,7 @@
installer_glob: "{{ lookup('fileglob', '{{role_path}}/files/kasm_workspaces_*.tar.gz', wantlist=True) + lookup('fileglob', '{{role_path}}/files/kasm_release_*.tar.gz', wantlist=True) }}"
service_images_glob: "{{ lookup('fileglob', '{{role_path}}/files/kasm_workspaces_service_images*.tar.gz', wantlist=True) + lookup('fileglob', '{{role_path}}/files/kasm_release_service_images*.tar.gz', wantlist=True) }}"
workspace_images_glob: "{{ lookup('fileglob', '{{role_path}}/files/kasm_workspaces_workspace_images_*.tar.gz', wantlist=True) + lookup('fileglob', '{{role_path}}/files/kasm_release_workspace_images_*.tar.gz', wantlist=True) }}"
network_plugin_glob: "{{ lookup('fileglob', '{{role_path}}//files/kasmweb_network_plugin_*.tar.gz', wantlist=True)}}"
delegate_to: localhost
- set_fact:
@ -10,6 +11,7 @@
installer_file: "{{ installer_glob | difference(service_images_glob) | difference(workspace_images_glob) | first | default(None) }}"
service_images_file: "{{ service_images_glob | first | default(None) }}"
workspace_images_file: "{{ workspace_images_glob | first | default(None) }}"
network_plugin_file: "{{ network_plugin_glob | first | default(None) }}"
- name: Assert that Kasm installer exists
assert:
@ -37,3 +39,10 @@
dest: "{{ tempdir.path }}"
register: workspace_images_copy
when: workspace_images_file
- name: Copy Network Plugin
copy:
src: "{{ network_plugin_file }}"
dest: "{{ tempdir.path }}"
register: network_plugin_copy
when: network_plugin_file

View file

@ -37,6 +37,19 @@
become: true
when: kasm_network.stdout | length > 0
- name: Check for kasm sidecar network
shell: docker network ls -q -f name=kasm_sidecar_network
register: kasm_sidecar_network
become: true
ignore_errors: true
changed_when: false
- name: Remove kasm sidecar network
shell: docker network rm kasm_sidecar_network
ignore_errors: true
become: true
when: kasm_sidecar_network.stdout | length > 0
- name: Get kasm database docker volume
shell: docker volume ls --filter name=kasm_db_* -q
ignore_errors: true
@ -64,11 +77,16 @@
docker images kasmweb/api-private -q
docker images kasmweb/guac -q
docker images kasmweb/guac-private -q
docker images kasmweb/kasm-guac -q
docker images kasmweb/kasm-guac-private -q
docker images kasmweb/proxy -q
docker images kasmweb/proxy-private -q
docker images redis -q
docker images postgres -q
docker images kasmweb/rdp-gateway -q
docker images kasmweb/rdp-gateway-private -q
docker images kasmweb/rdp-https-gateway -q
docker images kasmweb/rdp-https-gateway-private -q
register: kasm_images
become: true
ignore_errors: true
@ -80,6 +98,27 @@
ignore_errors: true
with_items: "{{ kasm_images.stdout_lines }}"
- name: Get sidecar plugin
shell: "docker plugin ls"
become: true
ignore_errors: true
changed_when: false
register: plugin_list
- name: Filter sidecar plugin
set_fact:
sidecar_plugins: "{{ plugin_list.stdout_lines | select('match', '.*Kasm Network plugin for Docker.*') | list }}"
- name: Disable sidecar plugin
shell: "docker plugin disable {{item.split()[1]}}" # Grab second column... It contains the plugin name
become: true
with_items: "{{ sidecar_plugins }}"
- name: Remove sidecar plugin
shell: "docker plugin rm {{item.split()[1]}}" # Grab second column... It contains the plugin name
become: true
with_items: "{{ sidecar_plugins }}"
- name: Remove kasm install directory
file:
path: /opt/kasm/