Skip to content

fix(examples): Upgrading ubuntu example to 22.04 #2250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/ubuntu/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module "runners" {
ami_owners = ["099720109477"] # Canonical's Amazon account ID

ami_filter = {
name = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
name = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
}

# Custom build AMI, no custom userdata needed.
Expand Down
15 changes: 8 additions & 7 deletions examples/ubuntu/templates/user-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ ${pre_install}
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
awscli \
jq \
build-essential \
curl \
wget \
git \
iptables \
jq \
uidmap \
build-essential \
unzip
unzip \
wget

user_name=ubuntu
user_id=$(id -ru $user_name)
Expand Down Expand Up @@ -43,16 +44,16 @@ WantedBy=default.target

EOF

echo export XDG_RUNTIME_DIR=/run/user/$user_id >>/home/$user_name/.profile
echo export XDG_RUNTIME_DIR=/run/user/$user_id >>/home/$user_name/.bashrc

systemctl daemon-reload
systemctl enable [email protected]
systemctl start [email protected]

curl -fsSL https://get.docker.com/rootless >>/opt/rootless.sh && chmod 755 /opt/rootless.sh
su -l $user_name -c /opt/rootless.sh
echo export DOCKER_HOST=unix:///run/user/$user_id/docker.sock >>/home/$user_name/.profile
echo export PATH=/home/$user_name/bin:$PATH >>/home/$user_name/.profile
echo export DOCKER_HOST=unix:///run/user/$user_id/docker.sock >>/home/$user_name/.bashrc
echo export PATH=/home/$user_name/bin:$PATH >>/home/$user_name/.bashrc

# Run docker service by default
loginctl enable-linger $user_name
Expand Down