Skip to content

Commit 4102750

Browse files
committed
feat: add Ubuntu 24.04 support
1 parent be49000 commit 4102750

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ Once you get the account, follow the *Before you begin* and *1. Prepare* step in
6262

6363
This module was tested with:
6464

65-
* Ubuntu 20.04, 22.04 (ubuntu remote user)
66-
* Ubuntu 20.04, 22.04 Minimal (ubuntu remote user)
65+
* Ubuntu 20.04, 22.04, 24.04 (ubuntu remote user)
66+
* Ubuntu 20.04, 22.04 Minimal, 24.04 (ubuntu remote user)
6767
* Oracle Linux 8, 9 (opc remote user)
6868

6969
### Terraform OCI user creation (Optional)

files/k3s-install-agent.sh

+11-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@ check_os() {
2424
}
2525

2626
install_oci_cli_ubuntu(){
27-
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y python3 python3-pip nginx
27+
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y python3 python3-pip nginx libnginx-mod-stream
2828
systemctl enable nginx
29-
pip install oci-cli
29+
# https://github.com/oracle/oci-cli/issues/875
30+
LATEST_OCICLI=$(curl -L https://api.github.com/repos/oracle/oci-cli/releases | \
31+
jq -r 'sort_by(.name) | reverse | .[0].name') ;
32+
echo "LATEST_OCICLI=$${LATEST_OCICLI}" ;
33+
bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)" \
34+
-s \
35+
--accept-all-defaults \
36+
--oci-cli-version $${LATEST_OCICLI}
3037
}
3138

3239
install_oci_cli_oracle(){
@@ -132,8 +139,9 @@ cat << 'EOF' > /root/find_ips.sh
132139
export OCI_CLI_AUTH=instance_principal
133140
private_ips=()
134141
142+
export PATH="/root/bin:$PATH"
135143
# Fetch the OCID of all the running instances in OCI and store to an array
136-
instance_ocids=$(oci search resource structured-search --query-text "QUERY instance resources where lifeCycleState='RUNNING'" --query 'data.items[*].identifier' --raw-output | jq -r '.[]' )
144+
instance_ocids=$(oci search resource structured-search --query-text "QUERY instance resources where lifeCycleState='RUNNING'" --query 'data.items[*].identifier' --raw-output | jq -r '.[]' )
137145
138146
# Iterate through the array to fetch details of each instance one by one
139147
for val in $${instance_ocids[@]} ; do

files/k3s-install-server.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,14 @@ if [[ "$operating_system" == "ubuntu" ]]; then
580580
apt-get install -y software-properties-common jq
581581
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
582582
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y python3 python3-pip
583-
pip install oci-cli
583+
# https://github.com/oracle/oci-cli/issues/875
584+
LATEST_OCICLI=$(curl -L https://api.github.com/repos/oracle/oci-cli/releases | \
585+
jq -r 'sort_by(.name) | reverse | .[0].name') ;
586+
echo "LATEST_OCICLI=$${LATEST_OCICLI}" ;
587+
bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)" \
588+
-s \
589+
--accept-all-defaults \
590+
--oci-cli-version $${LATEST_OCICLI}
584591

585592
# Fix /var/log/journal dir size
586593
echo "SystemMaxUse=100M" >> /etc/systemd/journald.conf
@@ -611,6 +618,7 @@ if [[ "$operating_system" == "oraclelinux" ]]; then
611618
fi
612619

613620
export OCI_CLI_AUTH=instance_principal
621+
export PATH="/root/bin:$PATH"
614622
first_instance=$(oci compute instance list --compartment-id ${compartment_ocid} --availability-domain ${availability_domain} --lifecycle-state RUNNING --sort-by TIMECREATED | jq -r '.data[]|select(."display-name" | endswith("k3s-servers")) | .["display-name"]' | tail -n 1)
615623
instance_id=$(curl -s -H "Authorization: Bearer Oracle" -L http://169.254.169.254/opc/v2/instance | jq -r '.displayName')
616624

0 commit comments

Comments
 (0)