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

Revisiting ssh-oidc config #370

Merged
merged 8 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 0 additions & 8 deletions deploy/cloud-info/backend.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# This is where the info about the deployment is to be stored
enolfc marked this conversation as resolved.
Show resolved Hide resolved
terraform {
backend "swift" {
container = "terraform"
cloud = "backend"
}
}

# The provider where the deployment is actually performed
provider "openstack" {
cloud = "deploy"
Expand Down
18 changes: 17 additions & 1 deletion deploy/cloud-info/main.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
resource "openstack_networking_secgroup_v2" "motley" {
name = "motley"
description = "Open ports for motley-cue"
delete_default_rules = "true"
}

resource "openstack_networking_secgroup_rule_v2" "motley-8080" {
direction = "ingress"
ethertype = "IPv4"
protocol = "tcp"
port_range_min = 8080
port_range_max = 8080
remote_ip_prefix = "0.0.0.0/0"
security_group_id = openstack_networking_secgroup_v2.motley.id
}

resource "openstack_compute_instance_v2" "cloud-info" {
name = "cloud-info"
image_id = var.image_id
flavor_id = var.flavor_id
security_groups = ["default"]
security_groups = ["default", "motley"]
enolfc marked this conversation as resolved.
Show resolved Hide resolved
user_data = file("cloud-init.yaml")
network {
uuid = var.net_id
Expand Down
3 changes: 1 addition & 2 deletions deploy/cloud-init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ users:

packages:
- git
- ansible
- jq
- python3-openstackclient
- python3-pip
- python3.10-venv
- python3-venv
- retry

write_files:
Expand Down
12 changes: 12 additions & 0 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,25 @@ image_sync_image: "ghcr.io/egi-federation/fedcloud-image-sync:sha-$SHORT_SHA"
site_config_dir: "$(readlink -f ../sites)"
EOF

# get access token for motley-cue
CLIENT_ID=$(yq -r '.fedcloudops.client_id' secrets.yaml)
CLIENT_SECRET=$(yq -r '.fedcloudops.client_secret' secrets.yaml)
SCOPE="openid%20email%20profile%20voperson_id%20eduperson_entitlement"
ACCESS_TOKEN=$(curl --request POST "https://aai.egi.eu/auth/realms/egi/protocol/openid-connect/token" \
--data "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&scope=$SCOPE" |
jq -r ".access_token")

# use pip-installed Ansible (apt version is too old)
pip install ansible

# install Ansible dependencies
ansible-galaxy role install -r galaxy-requirements.yaml

# Configure!
if ansible-playbook -i inventory.yaml \
--extra-vars @secrets.yaml \
--extra-vars @extra-vars.yaml \
--extra-vars ACCESS_TOKEN="$ACCESS_TOKEN" \
--tags "$TAGS" \
playbook.yaml >ansible.log 2>&1; then
status_summary="success"
Expand Down
2 changes: 1 addition & 1 deletion deploy/playbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
ssh_oidc_other_vos_name: cloud.egi.eu
ssh_oidc_other_vos_role: auditor
tags:
- never
- always
- role: catchall
vars:
site_config_dir: ../sites/