From 22e82b131eb9419e1266de4e6cf11c5c759b1c61 Mon Sep 17 00:00:00 2001
From: Bo-Chun Louis Chen <louistw@uab.edu>
Date: Thu, 31 Aug 2023 15:19:46 -0500
Subject: [PATCH] Format template files

---
 openstack-compute/nodeimage.pkr.hcl | 44 ++++++++++++++--------------
 openstack-compute/variables.pkr.hcl | 22 +++++++-------
 openstack-gpu/nodeimage.pkr.hcl     | 45 ++++++++++++++---------------
 openstack-gpu/variables.pkr.hcl     | 22 +++++++-------
 openstack-ood/nodeimage.pkr.hcl     | 45 ++++++++++++++---------------
 openstack-ood/variables.pkr.hcl     | 22 +++++++-------
 openstack/nodeimage.pkr.hcl         | 44 ++++++++++++++--------------
 openstack/variables.pkr.hcl         | 22 +++++++-------
 8 files changed, 129 insertions(+), 137 deletions(-)

diff --git a/openstack-compute/nodeimage.pkr.hcl b/openstack-compute/nodeimage.pkr.hcl
index 6874a55..fd7ac1f 100644
--- a/openstack-compute/nodeimage.pkr.hcl
+++ b/openstack-compute/nodeimage.pkr.hcl
@@ -1,44 +1,42 @@
 locals {
-    local_image_name = "${var.image_name}${var.image_date_suffix ? formatdate("YYYYMMDDHHmm", timestamp()): ""}"
+  local_image_name = "${var.image_name}${var.image_date_suffix ? formatdate("YYYYMMDDHHmm", timestamp()) : ""}"
 }
 
 source "openstack" "image" {
-  skip_create_image = var.skip_create_image
-  image_name        = local.local_image_name
-  source_image      = var.source_image
-  image_members     = var.image_membership
+  skip_create_image         = var.skip_create_image
+  image_name                = local.local_image_name
+  source_image              = var.source_image
+  image_members             = var.image_membership
   image_auto_accept_members = var.auto_accept_members
-  image_tags        = var.image_tags
-  image_disk_format = var.image_format
-  volume_size       = 10
-  flavor            = var.flavor
-  instance_name     = var.build_instance_name
-
-  use_blockstorage_volume = true
-  floating_ip_network = var.floating_ip_network
-  networks = var.networks
-  security_groups = var.security_groups
-
-  ssh_username = var.ssh_username
+  image_tags                = var.image_tags
+  image_disk_format         = var.image_format
+  volume_size               = 10
+  flavor                    = var.flavor
+  instance_name             = var.build_instance_name
+  use_blockstorage_volume   = true
+  floating_ip_network       = var.floating_ip_network
+  networks                  = var.networks
+  security_groups           = var.security_groups
+  ssh_username              = var.ssh_username
 }
 
 build {
   sources = ["source.openstack.image"]
 
   provisioner "ansible" {
-    user = var.ssh_username
-    groups = ["compute"]
+    user          = var.ssh_username
+    groups        = ["compute"]
     playbook_file = "./ansible/compute.yml"
-    roles_path = "./ansible/roles"
+    roles_path    = "./ansible/roles"
     extra_arguments = [
       "--extra-vars", "root_ssh_key='${var.root_ssh_key}'"
     ]
   }
 
   provisioner "ansible" {
-    user = var.ssh_username
-    groups = ["compute"]
+    user             = var.ssh_username
+    groups           = ["compute"]
     ansible_env_vars = ["ANSIBLE_HOST_KEY_CHECKING=False"]
-    playbook_file = "./CRI_XCBC/compute-packer.yaml"
+    playbook_file    = "./CRI_XCBC/compute-packer.yaml"
   }
 }
diff --git a/openstack-compute/variables.pkr.hcl b/openstack-compute/variables.pkr.hcl
index 3d2cb10..6fb12ce 100644
--- a/openstack-compute/variables.pkr.hcl
+++ b/openstack-compute/variables.pkr.hcl
@@ -1,5 +1,5 @@
 variable "root_ssh_key" {
-  type = string
+  type        = string
   description = "The root key to use for ssh"
 }
 
@@ -40,8 +40,8 @@ variable "auto_accept_members" {
 }
 
 variable "skip_create_image" {
-  type = bool
-  default = false
+  type        = bool
+  default     = false
   description = "A boolean value for skipping image creation at the end of the build"
 }
 
@@ -56,29 +56,29 @@ variable "flavor" {
 }
 
 variable "floating_ip_network" {
-  type = string
+  type        = string
   description = "floating ip network to use with (temporary) ip assignmnet to a vm"
 }
 
 variable "networks" {
-  type = list(string)
+  type        = list(string)
   description = "List of network UUIDs to assign to the network"
 }
 
 variable "security_groups" {
-  type = list(string)
-  default = []
+  type        = list(string)
+  default     = []
   description = "A list of security groups to add - you should make sure ssh access is open to the machine"
 }
 
 variable "build_instance_name" {
-  type = string
-  default = "compute"
+  type        = string
+  default     = "compute"
   description = "A name of build instance used for image build"
 }
 
 variable "ssh_username" {
-  type = string
-  default = "centos"
+  type        = string
+  default     = "centos"
   description = "The default username to use for SSH"
 }
diff --git a/openstack-gpu/nodeimage.pkr.hcl b/openstack-gpu/nodeimage.pkr.hcl
index 20531b2..01b9089 100644
--- a/openstack-gpu/nodeimage.pkr.hcl
+++ b/openstack-gpu/nodeimage.pkr.hcl
@@ -1,45 +1,42 @@
 locals {
-    local_image_name = "${var.image_name}${var.image_date_suffix ? formatdate("YYYYMMDDHHmm", timestamp()): ""}"
+  local_image_name = "${var.image_name}${var.image_date_suffix ? formatdate("YYYYMMDDHHmm", timestamp()) : ""}"
 }
 
 source "openstack" "image" {
-  skip_create_image = var.skip_create_image
-  image_name        = local.local_image_name
-  source_image      = var.source_image
-  image_members     = var.image_membership
+  skip_create_image         = var.skip_create_image
+  image_name                = local.local_image_name
+  source_image              = var.source_image
+  image_members             = var.image_membership
   image_auto_accept_members = var.auto_accept_members
-  image_tags        = var.image_tags
-  image_disk_format = var.image_format
-  volume_size       = 10
-  flavor            = var.flavor
-  instance_name     = var.build_instance_name
-
-  use_blockstorage_volume = true
-  floating_ip_network = var.floating_ip_network
-  networks = var.networks
-  security_groups = var.security_groups
-
-  ssh_username = var.ssh_username
+  image_tags                = var.image_tags
+  image_disk_format         = var.image_format
+  volume_size               = 10
+  flavor                    = var.flavor
+  instance_name             = var.build_instance_name
+  use_blockstorage_volume   = true
+  floating_ip_network       = var.floating_ip_network
+  networks                  = var.networks
+  security_groups           = var.security_groups
+  ssh_username              = var.ssh_username
 }
 
-# regular instance
 build {
   sources = ["source.openstack.image"]
 
   provisioner "ansible" {
-    user = var.ssh_username
-    groups = ["gpu"]
+    user          = var.ssh_username
+    groups        = ["gpu"]
     playbook_file = "./ansible/gpu.yml"
-    roles_path = "./ansible/roles"
+    roles_path    = "./ansible/roles"
     extra_arguments = [
       "--extra-vars", "root_ssh_key='${var.root_ssh_key}'"
     ]
   }
 
   provisioner "ansible" {
-    user = var.ssh_username
-    groups = ["compute"]
+    user             = var.ssh_username
+    groups           = ["compute"]
     ansible_env_vars = ["ANSIBLE_HOST_KEY_CHECKING=False"]
-    playbook_file = "./CRI_XCBC/compute-packer.yaml"
+    playbook_file    = "./CRI_XCBC/compute-packer.yaml"
   }
 }
diff --git a/openstack-gpu/variables.pkr.hcl b/openstack-gpu/variables.pkr.hcl
index b74f79b..4a0a662 100644
--- a/openstack-gpu/variables.pkr.hcl
+++ b/openstack-gpu/variables.pkr.hcl
@@ -1,5 +1,5 @@
 variable "root_ssh_key" {
-  type = string
+  type        = string
   description = "The root key to use for ssh"
 }
 
@@ -40,8 +40,8 @@ variable "auto_accept_members" {
 }
 
 variable "skip_create_image" {
-  type = bool
-  default = false
+  type        = bool
+  default     = false
   description = "A boolean value for skipping image creation at the end of the build"
 }
 
@@ -56,29 +56,29 @@ variable "flavor" {
 }
 
 variable "floating_ip_network" {
-  type = string
+  type        = string
   description = "floating ip network to use with (temporary) ip assignmnet to a vm"
 }
 
 variable "networks" {
-  type = list(string)
+  type        = list(string)
   description = "List of network UUIDs to assign to the network"
 }
 
 variable "security_groups" {
-  type = list(string)
-  default = []
+  type        = list(string)
+  default     = []
   description = "A list of security groups to add - you should make sure ssh access is open to the machine"
 }
 
 variable "build_instance_name" {
-  type = string
-  default = "gpu"
+  type        = string
+  default     = "gpu"
   description = "A name of build instance used for image build"
 }
 
 variable "ssh_username" {
-  type = string
-  default = "centos"
+  type        = string
+  default     = "centos"
   description = "The default username to use for SSH"
 }
diff --git a/openstack-ood/nodeimage.pkr.hcl b/openstack-ood/nodeimage.pkr.hcl
index a4b88eb..ff961c7 100644
--- a/openstack-ood/nodeimage.pkr.hcl
+++ b/openstack-ood/nodeimage.pkr.hcl
@@ -1,43 +1,42 @@
 locals {
-    local_image_name = "${var.image_name}${var.image_date_suffix ? formatdate("-YYYYMMDDHHmm", timestamp()): ""}"
+  local_image_name = "${var.image_name}${var.image_date_suffix ? formatdate("-YYYYMMDDHHmm", timestamp()) : ""}"
 }
 
 source "openstack" "image" {
-  skip_create_image = var.skip_create_image
-  image_name        = local.local_image_name
-  source_image      = var.source_image
-  image_members     = var.image_membership
+  skip_create_image         = var.skip_create_image
+  image_name                = local.local_image_name
+  source_image              = var.source_image
+  image_members             = var.image_membership
   image_auto_accept_members = var.auto_accept_members
-  image_tags        = var.image_tags
-  image_disk_format = var.image_format
-  volume_size       = 10
-  flavor            = var.flavor
-  instance_name     = var.build_instance_name
-
-  use_blockstorage_volume = true
-  floating_ip_network = var.floating_ip_network
-  networks = var.networks
-  security_groups = var.security_groups
-
-  ssh_username = var.ssh_username
+  image_tags                = var.image_tags
+  image_disk_format         = var.image_format
+  volume_size               = 10
+  flavor                    = var.flavor
+  instance_name             = var.build_instance_name
+  use_blockstorage_volume   = true
+  floating_ip_network       = var.floating_ip_network
+  networks                  = var.networks
+  security_groups           = var.security_groups
+  ssh_username              = var.ssh_username
 }
 
 build {
   sources = ["source.openstack.image"]
 
   provisioner "ansible" {
-    user = var.ssh_username
-    groups = ["ood"]
+    user          = var.ssh_username
+    groups        = ["ood"]
     playbook_file = "./ansible/ood.yml"
-    roles_path = "./ansible/roles"
+    roles_path    = "./ansible/roles"
     extra_arguments = [
       "--extra-vars", "root_ssh_key='${var.root_ssh_key}'"
     ]
   }
+
   provisioner "ansible" {
-    user = var.ssh_username
-    groups = ["ood", "knightly"]
+    user             = var.ssh_username
+    groups           = ["ood", "knightly"]
     ansible_env_vars = ["ANSIBLE_HOST_KEY_CHECKING=False"]
-    playbook_file = "./CRI_XCBC/ood-packer.yaml"
+    playbook_file    = "./CRI_XCBC/ood-packer.yaml"
   }
 }
diff --git a/openstack-ood/variables.pkr.hcl b/openstack-ood/variables.pkr.hcl
index ddd14de..488994d 100644
--- a/openstack-ood/variables.pkr.hcl
+++ b/openstack-ood/variables.pkr.hcl
@@ -1,5 +1,5 @@
 variable "root_ssh_key" {
-  type = string
+  type        = string
   description = "The root key to use for ssh"
 }
 
@@ -40,8 +40,8 @@ variable "auto_accept_members" {
 }
 
 variable "skip_create_image" {
-  type = bool
-  default = false
+  type        = bool
+  default     = false
   description = "A boolean value for skipping image creation at the end of the build"
 }
 
@@ -56,29 +56,29 @@ variable "flavor" {
 }
 
 variable "floating_ip_network" {
-  type = string
+  type        = string
   description = "floating ip network to use with (temporary) ip assignmnet to a vm"
 }
 
 variable "networks" {
-  type = list(string)
+  type        = list(string)
   description = "List of network UUIDs to assign to the network"
 }
 
 variable "security_groups" {
-  type = list(string)
-  default = []
+  type        = list(string)
+  default     = []
   description = "A list of security groups to add - you should make sure ssh access is open to the machine"
 }
 
 variable "build_instance_name" {
-  type = string
-  default = "ood"
+  type        = string
+  default     = "ood"
   description = "A name of build instance used for image build"
 }
 
 variable "ssh_username" {
-  type = string
-  default = "centos"
+  type        = string
+  default     = "centos"
   description = "The default username to use for SSH"
 }
diff --git a/openstack/nodeimage.pkr.hcl b/openstack/nodeimage.pkr.hcl
index cd94849..d8a0f1e 100644
--- a/openstack/nodeimage.pkr.hcl
+++ b/openstack/nodeimage.pkr.hcl
@@ -1,44 +1,42 @@
 locals {
-    local_image_name = "${var.image_name}${var.image_date_suffix ? formatdate("-YYYYMMDDHHmm", timestamp()): ""}"
+  local_image_name = "${var.image_name}${var.image_date_suffix ? formatdate("-YYYYMMDDHHmm", timestamp()) : ""}"
 }
 
 source "openstack" "image" {
-  skip_create_image = var.skip_create_image
-  image_name        = local.local_image_name
-  source_image      = var.source_image
-  image_members     = var.image_membership
+  skip_create_image         = var.skip_create_image
+  image_name                = local.local_image_name
+  source_image              = var.source_image
+  image_members             = var.image_membership
   image_auto_accept_members = var.auto_accept_members
-  image_tags        = var.image_tags
-  image_disk_format = var.image_format
-  volume_size       = 10
-  flavor            = var.flavor
-  instance_name     = var.build_instance_name
-
-  use_blockstorage_volume = true
-  floating_ip_network = var.floating_ip_network
-  networks = var.networks
-  security_groups = var.security_groups
-
-  ssh_username = var.ssh_username
+  image_tags                = var.image_tags
+  image_disk_format         = var.image_format
+  volume_size               = 10
+  flavor                    = var.flavor
+  instance_name             = var.build_instance_name
+  use_blockstorage_volume   = true
+  floating_ip_network       = var.floating_ip_network
+  networks                  = var.networks
+  security_groups           = var.security_groups
+  ssh_username              = var.ssh_username
 }
 
 build {
   sources = ["source.openstack.image"]
 
   provisioner "ansible" {
-    user = var.ssh_username
-    groups = ["base"]
+    user          = var.ssh_username
+    groups        = ["base"]
     playbook_file = "./ansible/base.yml"
-    roles_path = "./ansible/roles"
+    roles_path    = "./ansible/roles"
     extra_arguments = [
       "--extra-vars", "root_ssh_key='${var.root_ssh_key}'"
     ]
   }
 
   provisioner "ansible" {
-    user = var.ssh_username
-    groups = ["base"]
+    user             = var.ssh_username
+    groups           = ["base"]
     ansible_env_vars = ["ANSIBLE_HOST_KEY_CHECKING=False"]
-    playbook_file = "./CRI_XCBC/compute-packer.yaml"
+    playbook_file    = "./CRI_XCBC/compute-packer.yaml"
   }
 }
diff --git a/openstack/variables.pkr.hcl b/openstack/variables.pkr.hcl
index 2c17acb..674af41 100644
--- a/openstack/variables.pkr.hcl
+++ b/openstack/variables.pkr.hcl
@@ -1,5 +1,5 @@
 variable "root_ssh_key" {
-  type = string
+  type        = string
   description = "The root key to use for ssh"
 }
 
@@ -40,8 +40,8 @@ variable "auto_accept_members" {
 }
 
 variable "skip_create_image" {
-  type = bool
-  default = false
+  type        = bool
+  default     = false
   description = "A boolean value for skipping image creation at the end of the build"
 }
 
@@ -56,29 +56,29 @@ variable "flavor" {
 }
 
 variable "floating_ip_network" {
-  type = string
+  type        = string
   description = "floating ip network to use with (temporary) ip assignmnet to a vm"
 }
 
 variable "networks" {
-  type = list(string)
+  type        = list(string)
   description = "List of network UUIDs to assign to the network"
 }
 
 variable "security_groups" {
-  type = list(string)
-  default = []
+  type        = list(string)
+  default     = []
   description = "A list of security groups to add - you should make sure ssh access is open to the machine"
 }
 
 variable "build_instance_name" {
-  type = string
-  default = "base"
+  type        = string
+  default     = "base"
   description = "A name of build instance used for image build"
 }
 
 variable "ssh_username" {
-  type = string
-  default = "centos"
+  type        = string
+  default     = "centos"
   description = "The default username to use for SSH"
 }
-- 
GitLab