You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: community/modules/scripts/vdi-setup/README.md
+94-7Lines changed: 94 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,16 @@
1
1
## Description
2
2
3
-
Creates a containerised Guacamole instance. Works with the Rocky, Debian and Ubuntu images shown in blueprint example below.
3
+
Creates a containerised Guacamole instance. Currently designed to work mainly with the Rocky image in the blueprint example below. Ubuntu/Debian support previously worked too but fixes may be required due to updates.
4
4
5
5
## Features
6
6
7
7
-**VDI Tool Support**: Currently supports Guacamole for web-based VDI access
8
-
-**User Provisioning**: Supports local user creation with secure password management
9
-
-**VNC Integration**: Configures VNC servers for desktop access
8
+
-**User Provisioning**: Supports local user creation with secure password management and group management
9
+
-**VNC Integration**: Configures VNC servers for desktop access with port change support
10
10
-**Secret Manager Integration**: Secure password storage and retrieval for VDI users and webapp admin
11
-
-**VDI Monitoring System**: Automatic monitoring and reconfiguration capabilities with password reset flags and deployment status updates
11
+
-**VDI Monitoring System**: Automatic monitoring and reconfiguration capabilities with password reset flags and deployment status updates. [More info](roles/vdi_monitor/README.md).
12
12
-**Debug Mode**: Comprehensive logging when enabled via the `debug` variable
13
+
-**Port Change Support**: Handles both webapp port changes (container recreation) and user VNC port changes (SQL updates)
13
14
14
15
## Secret Manager Integration
15
16
@@ -21,11 +22,31 @@ The module integrates with Google Cloud Secret Manager for secure password handl
21
22
-**Reset Functionality**: Both individual user passwords (`reset_password`) and webapp admin password (`reset_webapp_admin_password`) can be forced to regenerate
22
23
-**Database Updates**: Password resets update existing database records without re-initializing the entire database
23
24
25
+
## Port Change and User Group Management
26
+
27
+
The module supports dynamic configuration changes without full redeployment:
28
+
29
+
### **Webapp Port Changes**
30
+
-**Container Recreation**: When `vdi_webapp_port` changes, the Guacamole webapp container is recreated with the new port
31
+
-**Database Synchronization**: Database passwords are automatically synchronized during port changes
32
+
-**Service Continuity**: VNC services remain unaffected during webapp port changes
33
+
34
+
### **User VNC Port Changes**
35
+
-**SQL Updates**: User VNC port changes are handled via database updates without container recreation
36
+
-**VNC Service Management**: VNC services are automatically stopped and restarted with new ports
37
+
-**X Server Cleanup**: Old X server processes are properly terminated before starting new ones
38
+
39
+
### **User Group Management**
40
+
-**Dynamic Group Changes**: When `vdi_user_group` changes, users are automatically migrated to the new group
41
+
-**Group Removal**: Users are removed from the old group and added to the new group
42
+
-**Idempotent Operations**: Group changes are safe to apply multiple times
43
+
24
44
## VDI Monitoring System
25
45
26
46
The module includes a monitoring system that:
27
47
28
-
-**Deployment Status**: Updates instance metadata to reflect deployment state (`available`, `reconfiguring`)
48
+
-**Deployment Status**: Updates instance metadata to reflect deployment state (`available`, `reconfiguring`, `failed`)
49
+
-**Targeted Updates**: Performs database-only updates for password resets and user changes without container recreation
29
50
-**Password Reset Flags**: Supports `reset_password` for individual users and `reset_webapp_admin_password` for the webapp admin account
30
51
-**Automatic Reconfiguration**: Detects changes and triggers reconfiguration when needed
31
52
-**Status Tracking**: Maintains deployment status through instance metadata
@@ -101,14 +122,13 @@ deployment_groups:
101
122
source: modules/compute/vm-instance
102
123
settings:
103
124
instance_image:
104
-
# Several supported image families:
105
125
family: hpc-rocky-linux-8
106
126
project: cloud-hpc-image-public
107
127
#family: debian-11
108
128
#project: debian-cloud
109
129
#family: ubuntu-2204-lts
110
130
#project: ubuntu-os-cloud
111
-
name_prefix: debian
131
+
name_prefix: guacamole
112
132
add_deployment_name_before_prefix: true
113
133
machine_type: e2-highcpu-8
114
134
tags: ["guacamole"]
@@ -156,3 +176,70 @@ After deployment, you can access the VDI in several ways:
156
176
```
157
177
158
178
- The web interface will then be accessible from http://localhost:8080/guacamole/ (for Guacamole)
179
+
180
+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
| <a name="input_debug"></a> [debug](#input\_debug) | Enable debug mode for verbose logging during VDI setup. | `bool` | `false` | no |
219
+
| <a name="input_deployment_name"></a> [deployment\_name](#input\_deployment\_name) | The name of the deployment. | `string` | n/a | yes |
220
+
| <a name="input_force_rerun"></a> [force\_rerun](#input\_force\_rerun) | Force complete container recreation and database re-initialization, bypassing all idempotency checks. Use only when troubleshooting or when the system is in a broken state. | `bool` | `false` | no |
221
+
| <a name="input_labels"></a> [labels](#input\_labels) | Key-value pairs of labels to be added to created resources. | `map(string)` | n/a | yes |
222
+
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | Project in which the HPC deployment will be created. | `string` | n/a | yes |
223
+
| <a name="input_region"></a> [region](#input\_region) | Region to place bucket containing startup script. | `string` | n/a | yes |
224
+
| <a name="input_reset_webapp_admin_password"></a> [reset\_webapp\_admin\_password](#input\_reset\_webapp\_admin\_password) | Force reset of the webapp admin password during reconfiguration. If true, a new password will be generated and stored in Secret Manager, even if an existing password exists. | `bool` | `false` | no |
225
+
| <a name="input_user_provision"></a> [user\_provision](#input\_user\_provision) | User type to create (local\_users supported. os-login to do. | `string` | `"local_users"` | no |
226
+
| <a name="input_vdi_resolution"></a> [vdi\_resolution](#input\_vdi\_resolution) | Desktop resolution for VNC sessions (e.g. 1920x1080). | `string` | `"1920x1080"` | no |
227
+
| <a name="input_vdi_tool"></a> [vdi\_tool](#input\_vdi\_tool) | VDI tool to deploy (guacamole currently supported). | `string` | `"guacamole"` | no |
228
+
| <a name="input_vdi_user_group"></a> [vdi\_user\_group](#input\_vdi\_user\_group) | Unix group to create/use for VDI users. | `string` | `"vdiusers"` | no |
229
+
| <a name="input_vdi_users"></a> [vdi\_users](#input\_vdi\_users) | List of VDI users to configure. Passwords are handled securely by the Ansible roles: if secret\_name is provided, the password is fetched from Secret Manager; if neither password nor secret\_name is provided, a random password is generated and stored in Secret Manager. If secret\_project is provided, it specifies the GCP project where the secret is stored (defaults to the deployment project). Set reset\_password to true to trigger password regeneration for auto-generated passwords. | <pre>list(object({<br/> username = string<br/> port = number<br/> secret_name = optional(string)<br/> secret_project = optional(string)<br/> reset_password = optional(bool)<br/> }))</pre> | `[]` | no |
230
+
| <a name="input_vdi_webapp_port"></a> [vdi\_webapp\_port](#input\_vdi\_webapp\_port) | Port to serve the Webapp interface from if applicable (note: containers will be recreated if changed) | `string` | `"8080"` | no |
231
+
| <a name="input_vnc_flavor"></a> [vnc\_flavor](#input\_vnc\_flavor) | The VNC server flavor to use (tigervnc currently supported) | `string` | `"tigervnc"` | no |
232
+
| <a name="input_vnc_port_max"></a> [vnc\_port\_max](#input\_vnc\_port\_max) | Maximum valid VNC port. | `number` | `5999` | no |
| <a name="input_zone"></a> [zone](#input\_zone) | Zone in which the VDI instances are created. | `string` | n/a | yes |
235
+
236
+
## Outputs
237
+
238
+
| Name | Description |
239
+
|------|-------------|
240
+
| <a name="output_guacamole_admin_password_secret"></a> [guacamole\_admin\_password\_secret](#output\_guacamole\_admin\_password\_secret) | The name of the Secret Manager secret containing the Guacamole admin password |
241
+
| <a name="output_guacamole_admin_username"></a> [guacamole\_admin\_username](#output\_guacamole\_admin\_username) | The admin username for Guacamole |
| <a name="output_vdi_runner"></a> [vdi\_runner](#output\_vdi\_runner) | Shell runner wrapping Ansible playbook + roles (for custom-image or direct use). |
244
+
| <a name="output_vdi_user_credentials"></a> [vdi\_user\_credentials](#output\_vdi\_user\_credentials) | Map of VDI user credentials stored in Secret Manager |
The `lock_manager` role is the central coordination mechanism for the VDI setup module. It manages deployment state, change detection, and ensures idempotent role execution.
4
+
5
+
## Overview
6
+
7
+
The lock manager uses a hash-based change detection system to determine when roles should run, preventing unnecessary re-execution while ensuring changes are properly applied.
8
+
9
+
## Key Features
10
+
11
+
### 1. **Hash-Based Change Detection**
12
+
13
+
-**Deployment Hash**: Tracks changes to deployment configuration (ports, tools, etc.)
14
+
-**User Hash**: Tracks changes to user configurations (additions, removals, password resets)
15
+
-**Smart Detection**: Only re-runs roles when relevant changes are detected
16
+
17
+
### 2. **Centralized Variable Management**
18
+
19
+
-**User Management Variables**: Calculates and propagates user change information to all roles
20
+
-**Port Change Detection**: Detects and tracks VNC port changes for existing users
0 commit comments