mbox series

[v3,0/6] Replace terraform update_ssh_config module

Message ID 20250224191215.637818-1-cel@kernel.org (mailing list archive)
Headers show
Series Replace terraform update_ssh_config module | expand

Message

Chuck Lever Feb. 24, 2025, 7:12 p.m. UTC
From: Chuck Lever <chuck.lever@oracle.com>

Luis suggested merging the way guestfs and terraform handle ssh
host config. This series is a step in that direction.

guestfs provisioning is currently implemented nearly entirely by
shell scripts. That makes it somewhat high risk to re-write both
terraform and guestfs to use shared infrastructure at the same time.
So instead of building infrastructure that guestfs and terraform can
share, I'm leaving guestfs out of the equation for the moment. All
this series does is make terraform ssh configuration behave more
like guestfs.

Subsequent work can replace the current set of guestfs scripts with
Ansible playbooks, and then more common ssh infrastructure can be
introduced that both provisioning methods can utilize.

Change since v2:
- Move terraform bringup/destroy into an Ansible playbook
- Move terraform's ssh configuration into that playbook
- Tested with AWS, Azure, and OCI

Changes since RFC:
- Split the RFC series into smaller patches for easier review
- The "Include" directive now follows CONFIG_KDEVOPS_SSH_CONFIG
- Various bug fixes and optimizations

Chuck Lever (6):
  terraform: Replace scripts/*_terraform.sh with an Ansible playbook
  ssh.Makefile: Define a kdevops_ssh_config variable
  terraform: Clean up ssh configuration during "make destroy"
  terraform: Add ssh hosts to ~/.ssh/config_kdevops_{{ sha1sum }}
  terraform: "make mrproper" should remove terraform/*/.terraform
  terraform: Remove the terrraform update_ssh_config module

 Makefile                                      |  1 +
 kconfigs/Kconfig.ssh                          | 19 +++-
 playbooks/roles/terraform/defaults/main.yml   |  3 +
 playbooks/roles/terraform/tasks/main.yml      | 86 +++++++++++++++++++
 .../roles/terraform/templates/ssh_config.j2   | 15 ++++
 playbooks/terraform.yml                       |  5 ++
 scripts/bringup_terraform.sh                  | 12 ---
 scripts/destroy_terraform.sh                  | 10 ---
 scripts/ssh.Makefile                          | 10 ++-
 scripts/terraform.Makefile                    | 35 ++++++--
 terraform/aws/output.tf                       | 30 ++-----
 terraform/aws/update_ssh_config.tf            |  1 -
 terraform/aws/update_ssh_config_use.tf        | 12 ---
 terraform/azure/output.tf                     | 22 ++---
 terraform/azure/update_ssh_config.tf          |  1 -
 terraform/azure/update_ssh_config_use.tf      |  4 -
 terraform/gce/output.tf                       | 31 ++-----
 terraform/gce/update_ssh_config.tf            |  1 -
 terraform/gce/update_ssh_config_use.tf        |  4 -
 terraform/oci/output.tf                       |  9 ++
 terraform/oci/update_ssh_config.tf            |  1 -
 terraform/oci/update_ssh_config_use.tf        |  8 --
 terraform/openstack/output.tf                 |  9 ++
 terraform/openstack/update_ssh_config.tf      |  1 -
 terraform/openstack/update_ssh_config_use.tf  |  4 -
 terraform/update_ssh_config.tf                | 17 ----
 26 files changed, 198 insertions(+), 153 deletions(-)
 create mode 100644 playbooks/roles/terraform/defaults/main.yml
 create mode 100644 playbooks/roles/terraform/tasks/main.yml
 create mode 100644 playbooks/roles/terraform/templates/ssh_config.j2
 create mode 100644 playbooks/terraform.yml
 delete mode 100755 scripts/bringup_terraform.sh
 delete mode 100755 scripts/destroy_terraform.sh
 delete mode 120000 terraform/aws/update_ssh_config.tf
 delete mode 100644 terraform/aws/update_ssh_config_use.tf
 delete mode 120000 terraform/azure/update_ssh_config.tf
 delete mode 100644 terraform/azure/update_ssh_config_use.tf
 delete mode 120000 terraform/gce/update_ssh_config.tf
 delete mode 100644 terraform/gce/update_ssh_config_use.tf
 create mode 100644 terraform/oci/output.tf
 delete mode 120000 terraform/oci/update_ssh_config.tf
 delete mode 100644 terraform/oci/update_ssh_config_use.tf
 delete mode 120000 terraform/openstack/update_ssh_config.tf
 delete mode 100644 terraform/openstack/update_ssh_config_use.tf
 delete mode 100644 terraform/update_ssh_config.tf