Skip to content

Commit

Permalink
nodepool: set instance hostname via sudo
Browse files Browse the repository at this point in the history
Grant passwordless sudo to the jenkins user.
Setup hostname
Get rid of sudo rule via the ready script.

Later on we will run puppet as well to have the instance fully ready.

Bug: T111377
Change-Id: I9aaa5900c6367216b17efd95e587c343ceb78497
  • Loading branch information
hashar committed Sep 8, 2015
1 parent b63aa03 commit a4bb9d2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions dib/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ export DIB_IMAGE_NAME=${DIB_IMAGE_NAME:-"image-${DIB_RELEASE}-${DATE}"}
export IMAGE_TYPE="qcow2"

export DIB_CLOUD_INIT_DATASOURCES='Ec2'

# sudo rule is removed by /nodepool/scripts/ready.sh
export DIB_DEV_USER_USERNAME='jenkins'
export DIB_DEV_USER_AUTHORIZED_KEYS='dib_jenkins_id_rsa.pub'
export DIB_DEV_USER_PWDLESS_SUDO='yes'

export QEMU_IMG_OPTIONS='compat=0.10' # XXX might not be needed

Expand Down
10 changes: 10 additions & 0 deletions nodepool/scripts/ready.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e
set -u
set -x
set -o pipefail


# Get rid of jenkins sudo
rm -fv /etc/sudoers.d/jenkins
5 changes: 3 additions & 2 deletions nodepool/scripts/setup_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ fi;
set -u

HOSTNAME="$1"
echo "Placeholder Nodepool setup script"
echo "Hostname: $1"
echo "Hostname: $HOSTNAME"
sudo hostname $HOSTNAME
echo "127.0.0.1 $HOSTNAME" >> /etc/hosts

0 comments on commit a4bb9d2

Please sign in to comment.