From 6835ca861ae2c38b261375baca44cfd64cb864e8 Mon Sep 17 00:00:00 2001 From: Ian Tangney Date: Tue, 26 Oct 2021 14:29:47 -0400 Subject: [PATCH] KASM-2036 Ensure that scaling up a deployment works properly --- README.md | 23 +++++++++++++++++++++++ roles/install_common/tasks/main.yml | 23 ++++++++++++++++------- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4743f34..7447a8e 100644 --- a/README.md +++ b/README.md @@ -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) +### 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 This playbook uninstalls Kasm workspaces from DB, WebApp and Agent servers specified in the `inventory` file. diff --git a/roles/install_common/tasks/main.yml b/roles/install_common/tasks/main.yml index 059df2e..4fd9574 100644 --- a/roles/install_common/tasks/main.yml +++ b/roles/install_common/tasks/main.yml @@ -6,10 +6,8 @@ path: /opt/kasm/current register: kasm_path -- assert: - that: - - 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: + kasm_installed: "{{ kasm_path.stat.exists }}" - set_fact: 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 shell: cat /proc/meminfo | grep SwapTotal | awk '{print $2 * 1024}' register: current_swap_size + changed_when: false - set_fact: # 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" 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: + - not kasm_installed - name: Run Kasm db install tasks include_tasks: file: db_install.yml - when: "'db' in group_names" + when: + - "'db' in group_names" + - not kasm_installed - name: Run Kasm web install tasks include_tasks: file: web_install.yml - when: "'web' in group_names" + when: + - "'web' in group_names" + - not kasm_installed - name: Run Kasm agent install tasks include_tasks: 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 service: