From: Fatih Degirmenci Date: Mon, 10 May 2021 07:49:29 +0000 (+0200) Subject: nsm: Minor fixes to NSM packer template X-Git-Url: https://gerrit.nordix.org/gitweb?a=commitdiff_plain;h=920ebe97baa2c649cb2f57217cc7be6d3275def9;hp=cd707f7f60c2eb6b0fbe9a862f04e34160ed7a55;p=infra%2Ftools.git nsm: Minor fixes to NSM packer template Change-Id: I8b45e9be5e950445e49631e845ebe263ee365c55 --- 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 index 0000000..5f46efb --- /dev/null +++ b/infra/jenkins/slave-setup/nordix-nsm-build-server/authorized_keys @@ -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+YrnXzLEszsoeYqCEqXz8gm1tbV1MMtxN3w7IUEdekAslFeMpJ8fEzFj8Ii5IiIGVJtz2mKdhReJEmqkW0u0UBQbg8L8n4YLj2wuW4V6hkDS/p96DJeBXb/wgB4u2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S2u3mnbSnityQJc0wCR/xZWS5poOuvF4oJ5vx3Vr8RspKxyN4ooLQYXEjVjWxYb7U3PUZ7Gbiu5hiMwm+X9qyit9RmE5f27vNoqssdSdfHQ5K84txbcfRDQ19bMO2gRA+IA0xEVgZ root@esy52-afrelalto-nfs diff --git a/infra/jenkins/slave-setup/nordix-nsm-build-server/configure-image.sh b/infra/jenkins/slave-setup/nordix-nsm-build-server/configure-image-ubuntu1804.sh 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 b1ce3c7..76a7e6c 100644 --- a/infra/jenkins/slave-setup/nordix-nsm-build-server/configure-image.sh +++ b/infra/jenkins/slave-setup/nordix-nsm-build-server/configure-image-ubuntu1804.sh @@ -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 +# append ssh key injected by openstack to 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 chmod +x /var/lib/cloud/scripts/per-instance/copykeystojenkins.sh # vim: set ts=2 sw=2 expandtab: diff --git a/infra/jenkins/slave-setup/nordix-nsm-build-server/nordix-nsm-build-server-ubuntu1804.json b/infra/jenkins/slave-setup/nordix-nsm-build-server/nordix-nsm-build-server-ubuntu1804.json index d0b19b9..d9e098b 100644 --- a/infra/jenkins/slave-setup/nordix-nsm-build-server/nordix-nsm-build-server-ubuntu1804.json +++ b/infra/jenkins/slave-setup/nordix-nsm-build-server/nordix-nsm-build-server-ubuntu1804.json @@ -15,7 +15,12 @@ ], "provisioners": [ { - "script": "configure-image.sh", + "type": "file", + "source": "authorized_keys", + "destination": "/home/ubuntu/authorized_keys.packer" + }, + { + "script": "configure-image-ubuntu1804.sh", "type": "shell" } ]