nsm: Minor fixes to NSM packer template 31/8631/1
authorFatih Degirmenci <fdegir@gmail.com>
Mon, 10 May 2021 07:49:29 +0000 (09:49 +0200)
committerFatih Degirmenci <fdegir@gmail.com>
Mon, 10 May 2021 07:53:59 +0000 (09:53 +0200)
Change-Id: I8b45e9be5e950445e49631e845ebe263ee365c55

infra/jenkins/slave-setup/nordix-nsm-build-server/authorized_keys [new file with mode: 0644]
infra/jenkins/slave-setup/nordix-nsm-build-server/configure-image-ubuntu1804.sh [moved from infra/jenkins/slave-setup/nordix-nsm-build-server/configure-image.sh with 92% similarity]
infra/jenkins/slave-setup/nordix-nsm-build-server/nordix-nsm-build-server-ubuntu1804.json

diff --git a/infra/jenkins/slave-setup/nordix-nsm-build-server/authorized_keys b/infra/jenkins/slave-setup/nordix-nsm-build-server/authorized_keys
new file mode 100644 (file)
index 0000000..5f46efb
--- /dev/null
@@ -0,0 +1,5 @@
+# injected by packer
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCZt9Ge7X3ZT/bMnYRS/zaHrM94zp+dlWH5k4LdeCpMQu9PjI3VbOqCDgemaKgKVapKRpk6etu9+Sy+P4aWnRXZsAGHEmfSwcfVaRZ2LnEUKKwbvJ8SaaSopdhkfgNV5ztkh7E+3wHIEp+fsSIC/LRXGPvcbkfNlZko96Ihz4BW0ezaeF3ikINtHb9r/cV4zNONE5NJoNkjAAE7chAiaZ+tyca4Nonb8UsCWxHofjxWNAGsC9tyuIOYIBAdXQI8kpS7VarEHK2WyOmPxNPuJqy6yQ/MYpgkg1tY5x7XsKa/O0DNl5kdH3R3ECqQ7H+AHrL5UK0l87BFan6O9xJTpb0p jenkins
+ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArXQug0RDmcbEWKcVnTbffD8jAgzm/lVhwG+Qdlz6iZZwEyLSU4nq6ymo2ukG7xTC8yBv5T0rjTtjQollFPc6CcM4I8aPnr8adI3ajDEseI4k/9bjr8+YrnXzLEszsoeYqCEqXz8gm1tbV1M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V9708BMCtj9j0N7CrwrBwkLbIVIWGkf0jC5HEip9/04PE/4GSiB2ORim6I1RjOiASB52FCO+J4rc6LiQbFL+RRiimcRajwuWR4msLpr+c/S2u3mnbSnityQJc0wCR/xZWS5poOuvF4oJ5vx3Vr8RspKxyN4ooLQYXEjVjWxYb7U3PUZ7Gbiu5hiMwm+X9qyit9RmE5f27vNoqssdSdfHQ5K84txbcfRDQ19bMO2gRA+IA0xEVgZ root@esy52-afrelalto-nfs
similarity index 92%
rename from infra/jenkins/slave-setup/nordix-nsm-build-server/configure-image.sh
rename to infra/jenkins/slave-setup/nordix-nsm-build-server/configure-image-ubuntu1804.sh
index b1ce3c7d456535c5804bf148dfa0b842fffff20e..76a7e6c10cb5d5fdbf6c3b5dd915cdaad866c095 100644 (file)
@@ -63,11 +63,17 @@ sudo systemctl restart sshd
 sudo bash -c 'cat << EOF > /var/lib/cloud/scripts/per-instance/copykeystojenkins.sh
 #!/bin/bash
 sudo mkdir -p /home/jenkins/.ssh
 sudo bash -c 'cat << EOF > /var/lib/cloud/scripts/per-instance/copykeystojenkins.sh
 #!/bin/bash
 sudo mkdir -p /home/jenkins/.ssh
+# append ssh key injected by openstack to authorized_keys
 sudo cat /home/ubuntu/.ssh/authorized_keys >> /home/jenkins/.ssh/authorized_keys
 sudo cat /home/ubuntu/.ssh/authorized_keys >> /home/jenkins/.ssh/authorized_keys
+# append user ssh public keys uploaded by packer to authorized_keys
+sudo cat /home/ubuntu/authorized_keys.packer >> /home/jenkins/.ssh/authorized_keys
+# remove /home/ubuntu/authorized_keys.packer
+sudo rm -f /home/jenkins/authorized_keys.packer
 sudo chown -R jenkins:jenkins /home/jenkins/.ssh
 sudo chmod -R go-rwx /home/jenkins/.ssh
 sudo userdel -f -r ubuntu
 EOF'
 sudo chown -R jenkins:jenkins /home/jenkins/.ssh
 sudo chmod -R go-rwx /home/jenkins/.ssh
 sudo userdel -f -r ubuntu
 EOF'
+
 sudo chmod +x /var/lib/cloud/scripts/per-instance/copykeystojenkins.sh
 
 # vim: set ts=2 sw=2 expandtab:
 sudo chmod +x /var/lib/cloud/scripts/per-instance/copykeystojenkins.sh
 
 # vim: set ts=2 sw=2 expandtab:
index d0b19b9a2b8ba2aa3b7f0b464431f09674f83502..d9e098b3de9cbacfcae00fedbbe23ebae3dad8e6 100644 (file)
     ],
     "provisioners": [
         {
     ],
     "provisioners": [
         {
-            "script": "configure-image.sh",
+            "type": "file",
+            "source": "authorized_keys",
+            "destination": "/home/ubuntu/authorized_keys.packer"
+        },
+        {
+            "script": "configure-image-ubuntu1804.sh",
             "type": "shell"
         }
     ]
             "type": "shell"
         }
     ]