mirror of
https://github.com/kasmtech/ansible.git
synced 2026-07-17 16:46:36 +00:00
KASM-2035 Add support for offline installation.
- Instead of downloading the kasm_release tarball to every host directly, we copy it from the ansible host. - Allow user to put service_images and workspace_images in `install_common/files/` to do an offline install. - Update readme with new instructions.
This commit is contained in:
parent
5be8605200
commit
08fae58593
9 changed files with 54 additions and 23 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1 +1,3 @@
|
||||||
backup/
|
backup/
|
||||||
|
*.tar.gz
|
||||||
|
*.tar
|
||||||
|
|
|
||||||
10
README.md
10
README.md
|
|
@ -47,7 +47,11 @@ It has been tested on CentOS 7.9.2009, CentOS 8.4.2105, Debian 9.13, Debian 10.1
|
||||||
|
|
||||||
2. Open `inventory` file and fill in the hostnames / ips for the servers that will be fulfilling the agent, webapp and db roles.
|
2. Open `inventory` file and fill in the hostnames / ips for the servers that will be fulfilling the agent, webapp and db roles.
|
||||||
|
|
||||||
3. Run the deployment.
|
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`.
|
||||||
|
|
||||||
|
4. Run the deployment.
|
||||||
|
|
||||||
`ansible-playbook -Kk -u [username] -i inventory install_kasm.yml`
|
`ansible-playbook -Kk -u [username] -i inventory install_kasm.yml`
|
||||||
|
|
||||||
|
|
@ -57,9 +61,9 @@ It has been tested on CentOS 7.9.2009, CentOS 8.4.2105, Debian 9.13, Debian 10.1
|
||||||
|
|
||||||
`ansible-playbook -u [username] -i inventory install_kasm.yml`
|
`ansible-playbook -u [username] -i inventory install_kasm.yml`
|
||||||
|
|
||||||
4. Login to the deployment as admin@kasm.local using the IP of one of the WebApp servers (eg https://192.168.1.2)
|
5. Login to the deployment as admin@kasm.local using the IP of one of the WebApp servers (eg https://192.168.1.2)
|
||||||
|
|
||||||
5. Navigate to the Agents tab, and enable each Agent after it checks in. (May take a few minutes)
|
6. Navigate to the Agents tab, and enable each Agent after it checks in. (May take a few minutes)
|
||||||
|
|
||||||
### Adding Additional Agent / Webapp hosts to an existing installation
|
### Adding Additional Agent / Webapp hosts to an existing installation
|
||||||
|
|
||||||
|
|
|
||||||
0
roles/install_common/files/.gitkeep
Normal file
0
roles/install_common/files/.gitkeep
Normal file
|
|
@ -9,7 +9,7 @@
|
||||||
delay: 5
|
delay: 5
|
||||||
|
|
||||||
- name: Install agent role
|
- name: Install agent role
|
||||||
command: "bash {{ tempdir.path }}/kasm_release/install.sh -S agent -e -p {{ target_ip }} -m {{ web_ip }} -M {{ manager_token }}"
|
command: "bash {{ tempdir.path }}/kasm_release/install.sh -S agent -e -p {{ target_ip }} -m {{ web_ip }} -M {{ manager_token }} {{ '-s ' ~ service_images_copy.dest if service_images_file }} {{ '-w ' ~ workspace_images_copy.dest if workspace_images_file }}"
|
||||||
register: install_output
|
register: install_output
|
||||||
become: true
|
become: true
|
||||||
retries: 20
|
retries: 20
|
||||||
|
|
|
||||||
39
roles/install_common/tasks/copy_installer.yml
Normal file
39
roles/install_common/tasks/copy_installer.yml
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
# List of files in the files directory matching the installer, service_images, and workspace images.
|
||||||
|
- set_fact:
|
||||||
|
installer_glob: "{{ lookup('fileglob', '{{role_path}}/files/kasm_workspaces_*.tar.gz', wantlist=True) }}"
|
||||||
|
service_images_glob: "{{ lookup('fileglob', '{{role_path}}/files/kasm_workspaces_service_images*.tar.gz', wantlist=True) }}"
|
||||||
|
workspace_images_glob: "{{ lookup('fileglob', '{{role_path}}/files/kasm_workspaces_workspace_images_*.tar.gz', wantlist=True) }}"
|
||||||
|
delegate_to: localhost
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
# Our installer glob search will also include service_images and workspace_images so we filter them out with difference()
|
||||||
|
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) }}"
|
||||||
|
|
||||||
|
- name: Assert that Kasm installer exists
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- installer_file
|
||||||
|
fail_msg:
|
||||||
|
- "Kasm installer not found"
|
||||||
|
- "Ensure that kasm_workspaces installer tarfile is in {{role_path}}/files/"
|
||||||
|
|
||||||
|
- name: unarchive kasm installer
|
||||||
|
unarchive:
|
||||||
|
src: "{{ installer_file }}"
|
||||||
|
dest: "{{ tempdir.path }}"
|
||||||
|
|
||||||
|
- name: Copy service images
|
||||||
|
copy:
|
||||||
|
src: "{{ service_images_file }}"
|
||||||
|
dest: "{{ tempdir.path }}"
|
||||||
|
register: service_images_copy
|
||||||
|
when: service_images_file
|
||||||
|
|
||||||
|
- name: Copy Workspace images
|
||||||
|
copy:
|
||||||
|
src: "{{ workspace_images_file }}"
|
||||||
|
dest: "{{ tempdir.path }}"
|
||||||
|
register: workspace_images_copy
|
||||||
|
when: workspace_images_file
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
- name: Install database role
|
- name: Install database role
|
||||||
command: "bash {{ tempdir.path }}/kasm_release/install.sh -S db -e -Q {{database_password}} -R {{redis_password}} -U {{user_password}} -P {{admin_password}} -M {{manager_token}}"
|
command: "bash {{ tempdir.path }}/kasm_release/install.sh -S db -e -Q {{database_password}} -R {{redis_password}} -U {{user_password}} -P {{admin_password}} -M {{manager_token}} {{ '-s ' ~ service_images_copy.dest if service_images_file }} {{ '-w ' ~ workspace_images_copy.dest if workspace_images_file }}"
|
||||||
register: install_output
|
register: install_output
|
||||||
become: true
|
become: true
|
||||||
retries: 20
|
retries: 20
|
||||||
|
|
|
||||||
|
|
@ -59,20 +59,8 @@
|
||||||
state: present
|
state: present
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Download kasm installer
|
- include_tasks:
|
||||||
get_url:
|
file: copy_installer.yml
|
||||||
url: "{{ kasm_installer_url }}"
|
|
||||||
dest: "{{ tempdir.path }}/kasm.tar.gz"
|
|
||||||
checksum: "{{ kasm_installer_checksum }}"
|
|
||||||
register: kasm_installer
|
|
||||||
when:
|
|
||||||
- not kasm_installed
|
|
||||||
|
|
||||||
- name: unarchive kasm installer
|
|
||||||
unarchive:
|
|
||||||
remote_src: yes
|
|
||||||
src: "{{ kasm_installer.dest }}"
|
|
||||||
dest: "{{ tempdir.path }}"
|
|
||||||
when:
|
when:
|
||||||
- not kasm_installed
|
- not kasm_installed
|
||||||
|
|
||||||
|
|
@ -108,6 +96,7 @@
|
||||||
file:
|
file:
|
||||||
path: "{{ tempdir.path }}"
|
path: "{{ tempdir.path }}"
|
||||||
state: absent
|
state: absent
|
||||||
|
become: true
|
||||||
|
|
||||||
- name: Print credentials
|
- name: Print credentials
|
||||||
debug:
|
debug:
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
timeout: 60
|
timeout: 60
|
||||||
|
|
||||||
- name: Install web role
|
- name: Install web role
|
||||||
command: "bash {{ tempdir.path }}/kasm_release/install.sh -S app -e -q {{ db_ip }} -Q {{ database_password }} -R {{ redis_password }} -n {{ target_ip }}"
|
command: "bash {{ tempdir.path }}/kasm_release/install.sh -S app -e -q {{ db_ip }} -Q {{ database_password }} -R {{ redis_password }} -n {{ target_ip }} {{ '-s ' ~ service_images_copy.dest if service_images_file }} {{ '-w ' ~ workspace_images_copy.dest if workspace_images_file }}"
|
||||||
register: install_output
|
register: install_output
|
||||||
become: true
|
become: true
|
||||||
retries: 20
|
retries: 20
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
kasm_installer_url: https://kasm-static-content.s3.amazonaws.com/kasm_release_1.9.0.077388.tar.gz
|
|
||||||
kasm_installer_checksum: sha256:d925a20ee949ef6a9759587069983eb3a6d56b0532210e74be75894b2a5915ce
|
|
||||||
|
|
||||||
# If you want custom passwords change them below, otherwise they will be auto generated and displayed
|
# If you want custom passwords change them below, otherwise they will be auto generated and displayed
|
||||||
# in a message at the end of the run.
|
# in a message at the end of the run.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue