Merge branch 'feature/KASM-2036_scale_agent_webapp' into 'develop'

KASM-2036 Ensure that scaling up a deployment works properly

Closes KASM-2036

See merge request kasm-technologies/internal/ansible!8
This commit is contained in:
Justin Travis 2021-10-27 12:21:35 +00:00
commit 5be8605200
2 changed files with 39 additions and 7 deletions

View file

@ -61,6 +61,29 @@ It has been tested on CentOS 7.9.2009, CentOS 8.4.2105, Debian 9.13, Debian 10.1
5. Navigate to the Agents tab, and enable each Agent after it checks in. (May take a few minutes) 5. 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
The installation can be "scaled up" after being installed by adding additional hosts to the agent or db roles in the inventory file and rerunning the playbook.
Please ensure that redis_password, manager_token and database_password is set in `install_common/vars/main.yml`
If you did not save the redis_password, manager_token or database_password for your existing installation, they can be obtained using the following methods.
- Existing Database password can be obtained by logging into a webapp host and running the following command:
```
sudo grep " password" /opt/kasm/current/conf/app/api.app.config.yaml
```
- Existing Redis password can be obtained by logging into a webapp host and running the following command:
```
sudo grep "redis_password" /opt/kasm/current/conf/app/api.app.config.yaml
```
- Existing Manager token can be obtained by logging into an agent host and running the following command:
```
sudo grep "token" /opt/kasm/current/conf/app/agent.app.config.yaml
```
## Kasm Uninstall playbook ## Kasm Uninstall playbook
This playbook uninstalls Kasm workspaces from DB, WebApp and Agent servers specified in the `inventory` file. This playbook uninstalls Kasm workspaces from DB, WebApp and Agent servers specified in the `inventory` file.

View file

@ -6,10 +6,8 @@
path: /opt/kasm/current path: /opt/kasm/current
register: kasm_path register: kasm_path
- assert: - set_fact:
that: kasm_installed: "{{ kasm_path.stat.exists }}"
- not kasm_path.stat.exists
fail_msg: /opt/kasm/current exists, kasm appears to be installed. Please ensure kasm is uninstalled before continuing.
- set_fact: - set_fact:
db_ip: "{{ hostvars[groups['db'][0]]['ansible_default_ipv4']['address'] }}" db_ip: "{{ hostvars[groups['db'][0]]['ansible_default_ipv4']['address'] }}"
@ -31,6 +29,7 @@
# Meminfo outputs in Kb for some reason so we convert to bytes # Meminfo outputs in Kb for some reason so we convert to bytes
shell: cat /proc/meminfo | grep SwapTotal | awk '{print $2 * 1024}' shell: cat /proc/meminfo | grep SwapTotal | awk '{print $2 * 1024}'
register: current_swap_size register: current_swap_size
changed_when: false
- set_fact: - set_fact:
# We only want to make a swapfile large enough to make up the difference between # We only want to make a swapfile large enough to make up the difference between
@ -66,27 +65,37 @@
dest: "{{ tempdir.path }}/kasm.tar.gz" dest: "{{ tempdir.path }}/kasm.tar.gz"
checksum: "{{ kasm_installer_checksum }}" checksum: "{{ kasm_installer_checksum }}"
register: kasm_installer register: kasm_installer
when:
- not kasm_installed
- name: unarchive kasm installer - name: unarchive kasm installer
unarchive: unarchive:
remote_src: yes remote_src: yes
src: "{{ kasm_installer.dest }}" src: "{{ kasm_installer.dest }}"
dest: "{{ tempdir.path }}" dest: "{{ tempdir.path }}"
when:
- not kasm_installed
- name: Run Kasm db install tasks - name: Run Kasm db install tasks
include_tasks: include_tasks:
file: db_install.yml file: db_install.yml
when: "'db' in group_names" when:
- "'db' in group_names"
- not kasm_installed
- name: Run Kasm web install tasks - name: Run Kasm web install tasks
include_tasks: include_tasks:
file: web_install.yml file: web_install.yml
when: "'web' in group_names" when:
- "'web' in group_names"
- not kasm_installed
- name: Run Kasm agent install tasks - name: Run Kasm agent install tasks
include_tasks: include_tasks:
file: agent_install.yml file: agent_install.yml
when: "'agent' in group_names" when:
- "'agent' in group_names"
- not kasm_installed
- name: enable the docker service to run at boot - name: enable the docker service to run at boot
service: service: