From dc3195310c647143be89e8e7716478e93e37dc33 Mon Sep 17 00:00:00 2001 From: Thomas Nys Date: Thu, 8 Nov 2018 15:25:07 +0100 Subject: [PATCH] Add the option to add multiple ssh public keys for Azure infrastructure (#3674) This give users the option to define multiple ssh public keys when deploying the base infrastructure on Azure. --- contrib/azurerm/group_vars/all | 5 +++-- .../azurerm/roles/generate-templates/templates/bastion.json | 6 ++++-- .../azurerm/roles/generate-templates/templates/masters.json | 6 ++++-- .../azurerm/roles/generate-templates/templates/minions.json | 6 ++++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/contrib/azurerm/group_vars/all b/contrib/azurerm/group_vars/all index 0e809af80..7aaa346f6 100644 --- a/contrib/azurerm/group_vars/all +++ b/contrib/azurerm/group_vars/all @@ -1,5 +1,5 @@ -# Due to some Azure limitations (ex:- Storage Account's name must be unique), +# Due to some Azure limitations (ex:- Storage Account's name must be unique), # this name must be globally unique - it will be used as a prefix for azure components cluster_name: example @@ -20,7 +20,8 @@ admin_username: devops admin_password: changeme # MAKE SURE TO CHANGE THIS TO YOUR PUBLIC KEY to access your azure machines -ssh_public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLRzcxbsFDdEibiyXCSdIFh7bKbXso1NqlKjEyPTptf3aBXHEhVil0lJRjGpTlpfTy7PHvXFbXIOCdv9tOmeH1uxWDDeZawgPFV6VSZ1QneCL+8bxzhjiCn8133wBSPZkN8rbFKd9eEUUBfx8ipCblYblF9FcidylwtMt5TeEmXk8yRVkPiCuEYuDplhc2H0f4PsK3pFb5aDVdaDT3VeIypnOQZZoUxHWqm6ThyHrzLJd3SrZf+RROFWW1uInIDf/SZlXojczUYoffxgT1lERfOJCHJXsqbZWugbxQBwqsVsX59+KPxFFo6nV88h3UQr63wbFx52/MXkX4WrCkAHzN ablock-vwfs@dell-lappy" +ssh_public_keys: + - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLRzcxbsFDdEibiyXCSdIFh7bKbXso1NqlKjEyPTptf3aBXHEhVil0lJRjGpTlpfTy7PHvXFbXIOCdv9tOmeH1uxWDDeZawgPFV6VSZ1QneCL+8bxzhjiCn8133wBSPZkN8rbFKd9eEUUBfx8ipCblYblF9FcidylwtMt5TeEmXk8yRVkPiCuEYuDplhc2H0f4PsK3pFb5aDVdaDT3VeIypnOQZZoUxHWqm6ThyHrzLJd3SrZf+RROFWW1uInIDf/SZlXojczUYoffxgT1lERfOJCHJXsqbZWugbxQBwqsVsX59+KPxFFo6nV88h3UQr63wbFx52/MXkX4WrCkAHzN ablock-vwfs@dell-lappy" # Disable using ssh using password. Change it to false to allow to connect to ssh by password disablePasswordAuthentication: true diff --git a/contrib/azurerm/roles/generate-templates/templates/bastion.json b/contrib/azurerm/roles/generate-templates/templates/bastion.json index d765c9d36..5bf1d75ee 100644 --- a/contrib/azurerm/roles/generate-templates/templates/bastion.json +++ b/contrib/azurerm/roles/generate-templates/templates/bastion.json @@ -66,10 +66,12 @@ "disablePasswordAuthentication": "true", "ssh": { "publicKeys": [ + {% for key in ssh_public_keys %} { "path": "{{sshKeyPath}}", - "keyData": "{{ssh_public_key}}" - } + "keyData": "{{key}}" + }{% if loop.index < ssh_public_keys | length %},{% endif %} + {% endfor %} ] } } diff --git a/contrib/azurerm/roles/generate-templates/templates/masters.json b/contrib/azurerm/roles/generate-templates/templates/masters.json index ecfc72140..69a42cb68 100644 --- a/contrib/azurerm/roles/generate-templates/templates/masters.json +++ b/contrib/azurerm/roles/generate-templates/templates/masters.json @@ -162,10 +162,12 @@ "disablePasswordAuthentication": "{{disablePasswordAuthentication}}", "ssh": { "publicKeys": [ + {% for key in ssh_public_keys %} { "path": "{{sshKeyPath}}", - "keyData": "{{ssh_public_key}}" - } + "keyData": "{{key}}" + }{% if loop.index < ssh_public_keys | length %},{% endif %} + {% endfor %} ] } } diff --git a/contrib/azurerm/roles/generate-templates/templates/minions.json b/contrib/azurerm/roles/generate-templates/templates/minions.json index d25769374..3c122f34a 100644 --- a/contrib/azurerm/roles/generate-templates/templates/minions.json +++ b/contrib/azurerm/roles/generate-templates/templates/minions.json @@ -79,10 +79,12 @@ "disablePasswordAuthentication": "{{disablePasswordAuthentication}}", "ssh": { "publicKeys": [ + {% for key in ssh_public_keys %} { "path": "{{sshKeyPath}}", - "keyData": "{{ssh_public_key}}" - } + "keyData": "{{key}}" + }{% if loop.index < ssh_public_keys | length %},{% endif %} + {% endfor %} ] } }