Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change defaults so a cookiecutter environment is fully functional #473

Open
wants to merge 5 commits into
base: feature/k3s-monitoring
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ansible/roles/passwords/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ slurm_appliance_secrets:
vault_openhpc_mungekey: "{{ secrets_openhpc_mungekey | default(vault_openhpc_mungekey | default(secrets_openhpc_mungekey_default)) }}"
vault_freeipa_ds_password: "{{ vault_freeipa_ds_password | default(lookup('password', '/dev/null')) }}"
vault_freeipa_admin_password: "{{ vault_freeipa_admin_password | default(lookup('password', '/dev/null')) }}"
vault_openondemand_default_user_password: "{{ vault_openondemand_default_user_password | default(lookup('password', '/dev/null')) }}"
k3s_token: "{{ lookup('ansible.builtin.password', '/dev/null', length=64) }}"

secrets_openhpc_mungekey_default:
Expand Down
12 changes: 7 additions & 5 deletions docs/openondemand.README.md
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we git mv this to just docs/openondemand.md like the other files, given we're changing it pls?

Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ The above functionality is configured by running the `ansible/portal.yml` playbo

See the [ansible/roles/openondemand/README.md](../ansible/roles/openondemand/README.md) for more details on the variables described below.

At minimum the following must be defined:
- `openondemand_servername` - this must be defined for both `openondemand` and `grafana` hosts (when Grafana is enabled). It is suggested to place it groupvars for `all`.
- `openondemand_auth` and any corresponding options.
- `openondemand_desktop_partition` and `openondemand_jupyter_partition` if the corresponding inventory groups are defined.
- `openondemand_host_regex` if `openondemand_desktop` or `openondemand_jupyter` inventory groups are defined and/or proxying Grafana via Open Ondemand is required.
The following variables have been given default values to allow OOD to run in a newly created environment without additional configuration, but are likely to be overriden with site-specific values:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The following variables have been given default values to allow OOD to run in a newly created environment without additional configuration, but are likely to be overriden with site-specific values:
The following variables have been given default values to allow Open Ondemand to work in a newly created environment without additional configuration, but generally should be overridden in `environment/site/inventory/group_vars/all/` with site-specific values:

- `openondemand_servername` - this must be defined for both `openondemand` and `grafana` hosts (when Grafana is enabled). It is suggested to place it groupvars for `all`. Defaults to the IP address of the first host in the `openondemand` group.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `openondemand_servername` - this must be defined for both `openondemand` and `grafana` hosts (when Grafana is enabled). It is suggested to place it groupvars for `all`. Defaults to the IP address of the first host in the `openondemand` group.
- `openondemand_servername` - this must be defined for both `openondemand` and `grafana` hosts (when Grafana is enabled). Default is `ansible_host` (i.e. the IP address) of the first host in the `openondemand` group.

- `openondemand_auth` and any corresponding options. Defaults to `basic_pam`.
- `openondemand_desktop_partition` and `openondemand_jupyter_partition` if the corresponding inventory groups are defined. Defaults to the first compute group defined in the `compute` Terraform variable in `environments/{ENV}/terraform`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `openondemand_desktop_partition` and `openondemand_jupyter_partition` if the corresponding inventory groups are defined. Defaults to the first compute group defined in the `compute` Terraform variable in `environments/{ENV}/terraform`.
- `openondemand_desktop_partition` and `openondemand_jupyter_partition` if the corresponding inventory groups are defined. Defaults to the first compute group defined in the `compute` Terraform variable in `environments/$ENV/terraform`.


It is also recommended to set:
- `openondemand_dashboard_support_url`
Expand All @@ -45,3 +44,6 @@ If shared filesystems other than `$HOME` are available, add paths to `openondema
The appliance automatically configures Open Ondemand to proxy Grafana and adds a link to it on the Open Ondemand dashboard. This means no external IP (or SSH proxying etc) is required to access Grafana (which by default is deployed on the control node). To allow users to authenticate to Grafana, the simplest option is to enable anonymous (View-only) login by setting `grafana_auth_anonymous` (see [environments/common/inventory/group_vars/all/grafana.yml](../environments/common/inventory/group_vars/all/grafana.yml)[^1]).

[^1]: Note that if `openondemand_auth` is `basic_pam` and anonymous Grafana login is enabled, the appliance will (by default) configure Open Ondemand's Apache server to remove the Authorisation header from proxying of all `node/` addresses. This is done as otherwise Grafana tries to use this header to authenticate, which fails with the default configuration where only the admin Grafana user `grafana` is created. Note that the removal of this header in this configuration means it cannot be used to authenticate proxied interactive applications - however the appliance-deployed remote desktop and Jupyter Notebook server applications use other authentication methods. An alternative if using `basic_pam` is not to enable anonymous Grafana login and to create Grafana users matching the local users (e.g. in `environments/<env>/hooks/post.yml`).

# Access
By default the appliance authenticates against OOD with basic auth through PAM. If the `basic_users` group is enabled, by default it will create a user with username `ood_user` and its password is found under `vault_openondemand_default_user` in the appliance secrets store in `environments/{ENV}/inventory/group_vars/all/secrets.yml`. Other users can be defined by overriding the variables in `environments/common/inventory/group_vars/all/basic_users.yml`.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
# See: ansible/roles/basic_users/README.md
# for variable definitions.

ondemand_user_password: "{{ vault_openondemand_default_user_password }}"
wtripp180901 marked this conversation as resolved.
Show resolved Hide resolved

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

basic_users_homedir: /home
basic_users_users: []
basic_users_users:
wtripp180901 marked this conversation as resolved.
Show resolved Hide resolved
- name: ood_user
wtripp180901 marked this conversation as resolved.
Show resolved Hide resolved
password: "{{ ondemand_user_password | password_hash('sha512', 65534 | random(seed=inventory_hostname) | string) }}" # idempotent
uid: 1006
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@

# NB: Variables prefixed ood_ are all from https://github.com/OSC/ood-ansible

# openondemand_servername: '' # Must be defined when using openondemand
openondemand_servername: "{{ hostvars[groups['openondemand'].0].ansible_host if groups['openondemand'] else '' }}"

openondemand_auth: basic_pam

openondemand_jupyter_partition: "{{ openhpc_slurm_partitions[0]['name'] }}"
wtripp180901 marked this conversation as resolved.
Show resolved Hide resolved
openondemand_desktop_partition: "{{ openhpc_slurm_partitions[0]['name'] }}"

# Regex defining hosts which openondemand can proxy; the default regex is compute nodes (for apps) and grafana host,
# e.g. if the group `compute` has hosts `compute-{0,1,2,..}` this will be '(compute-\d+)|(control)'.
Expand Down
6 changes: 4 additions & 2 deletions environments/common/layouts/everything
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ login
[block_devices:children]
# Environment-specific so not defined here

[basic_users]
[basic_users:children]
# Add `openhpc` group to add Slurm users via creation of users on each node.
openhpc

[openondemand:children]
# Host to run Open Ondemand server on - subset of login
Expand All @@ -42,8 +43,9 @@ compute
# Subset of compute to run a Jupyter Notebook servers on via Open Ondemand
compute

[etc_hosts]
[etc_hosts:children]
# Hosts to manage /etc/hosts e.g. if no internal DNS. See ansible/roles/etc_hosts/README.md
cluster

[cuda]
# Hosts to install NVIDIA CUDA on - see ansible/roles/cuda/README.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ variable "cluster_name" {
variable "cluster_domain_suffix" {
type = string
description = "Domain suffix for cluster"
default = "invalid"
default = "internal"
}

variable "cluster_net" {
Expand Down
Loading