Skip to content

Feat: add Ubuntu 24.04 support #52

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ Once you get the account, follow the *Before you begin* and *1. Prepare* step in

This module was tested with:

* Ubuntu 20.04, 22.04 (ubuntu remote user)
* Ubuntu 20.04, 22.04 Minimal (ubuntu remote user)
* Ubuntu 20.04, 22.04, 24.04 (ubuntu remote user)
* Ubuntu 20.04, 22.04 Minimal, 24.04 (ubuntu remote user)
* Oracle Linux 8, 9 (opc remote user)

### Terraform OCI user creation (Optional)
Expand Down
14 changes: 11 additions & 3 deletions files/k3s-install-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,16 @@ check_os() {
}

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

install_oci_cli_oracle(){
Expand Down Expand Up @@ -132,8 +139,9 @@ cat << 'EOF' > /root/find_ips.sh
export OCI_CLI_AUTH=instance_principal
private_ips=()

export PATH="/root/bin:$PATH"
# Fetch the OCID of all the running instances in OCI and store to an array
instance_ocids=$(oci search resource structured-search --query-text "QUERY instance resources where lifeCycleState='RUNNING'" --query 'data.items[*].identifier' --raw-output | jq -r '.[]' )
instance_ocids=$(oci search resource structured-search --query-text "QUERY instance resources where lifeCycleState='RUNNING'" --query 'data.items[*].identifier' --raw-output | jq -r '.[]' )

# Iterate through the array to fetch details of each instance one by one
for val in $${instance_ocids[@]} ; do
Expand Down
10 changes: 9 additions & 1 deletion files/k3s-install-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,14 @@ if [[ "$operating_system" == "ubuntu" ]]; then
apt-get install -y software-properties-common jq
DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y python3 python3-pip
pip install oci-cli
# https://github.com/oracle/oci-cli/issues/875
LATEST_OCICLI=$(curl -L https://api.github.com/repos/oracle/oci-cli/releases | \
jq -r 'sort_by(.name) | reverse | .[0].name') ;
echo "LATEST_OCICLI=$${LATEST_OCICLI}" ;
bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)" \
-s \
--accept-all-defaults \
--oci-cli-version $${LATEST_OCICLI}

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

export OCI_CLI_AUTH=instance_principal
export PATH="/root/bin:$PATH"
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)
instance_id=$(curl -s -H "Authorization: Bearer Oracle" -L http://169.254.169.254/opc/v2/instance | jq -r '.displayName')

Expand Down