Skip to content

Commit

Permalink
Support Ubuntu 24
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-antoniak committed Sep 18, 2024
1 parent 08142af commit 3ae0728
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 23 deletions.
16 changes: 6 additions & 10 deletions ansible-control-host-docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:1
FROM ubuntu:22.04
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND noninteractive

# install all necessary software packages and dependencies
Expand All @@ -13,18 +13,15 @@ RUN apt-get update && apt-get install -y software-properties-common \
gnupg

RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 && \
apt-add-repository "deb http://ppa.launchpad.net/ansible/ansible/ubuntu jammy main" && \
apt-add-repository "deb http://ppa.launchpad.net/ansible/ansible/ubuntu noble main" && \
apt-get update && apt-get upgrade --yes && \
apt-get install --yes python3-pip && \
apt-get install python3-jmespath && \
apt-get install --yes python3-jmespath && \
apt-get install --yes ansible && \
apt-get install --yes python3-cryptography && \
apt-get autoremove && apt-get autoclean

RUN sudo python3 -m pip install ansible
RUN sudo python3 -m pip install cryptography

# create ubuntu user
RUN useradd -ms /bin/bash ubuntu
RUN usermod -aG sudo ubuntu
# switch to ubuntu user
USER ubuntu
WORKDIR /home/ubuntu/

Expand Down Expand Up @@ -52,4 +49,3 @@ RUN mkdir target_tls_files
RUN mkdir zdm_proxy_tls_files

ENTRYPOINT ["/bin/bash"]

10 changes: 9 additions & 1 deletion ansible/tasks/install_docker_ansible_module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@
state: absent
vars:
ansible_python_interpreter: python3
when: ansible_distribution_major_version != "24"

- name: Install Docker Module for Python
- name: Install Docker Module for Python Pip
pip:
name: docker
version: 2.7.0
vars:
ansible_python_interpreter: python3
when: ansible_distribution_major_version != "24"

- name: Install Docker Module for Python Apt
apt:
name: python3-docker
state: present
when: ansible_distribution_major_version == "24"
2 changes: 1 addition & 1 deletion orchestration-scripts/run_terraform_zdm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ zdm_vpc_cidr_prefix="172.18"
#custom_name_suffix=

# OPTIONAL: zdm_linux_distro to be used for both proxy and monitoring instances.
# Defaults to jammy (Ubuntu 22.04), valid options are focal, jammy, centos7, centos8, centos9, rocky8, rocky9, rhel7, rhel8.
# Defaults to noble (Ubuntu 24.04), valid options are focal, jammy, noble, centos7, centos8, centos9, rocky8, rocky9, rhel7, rhel8.
#zdm_linux_distro=

# OPTIONAL: AWS instance type to be used for each ZDM proxy. Defaults to c5.xlarge, almost always fine.
Expand Down
2 changes: 1 addition & 1 deletion orchestration-scripts/run_terraform_zdm_no_peering.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ zdm_vpc_cidr_prefix="172.18"
#custom_name_suffix=

# OPTIONAL: zdm_linux_distro to be used for both proxy and monitoring instances.
# Defaults to jammy (Ubuntu 22.04), valid options are focal, jammy, centos7, centos8, centos9, rocky8, rocky9, rhel7, rhel8.
# Defaults to noble (Ubuntu 24.04), valid options are focal, jammy, noble, centos7, centos8, centos9, rocky8, rocky9, rhel7, rhel8.
#zdm_linux_distro=

# OPTIONAL: AWS instance type to be used for each ZDM proxy. Defaults to c5.xlarge, almost always fine.
Expand Down
2 changes: 1 addition & 1 deletion orchestration-scripts/setup_ansible_control_host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ printf "# proxy instances \nHost %s.*\n IdentityFile %s/%s\n" "${zdm_proxy_priv
if ! command -v ansible &> /dev/null; then
echo "Installing Ansible"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
sudo apt-add-repository "deb http://ppa.launchpad.net/ansible/ansible/ubuntu jammy main"
sudo apt-add-repository "deb http://ppa.launchpad.net/ansible/ansible/ubuntu noble main"
sudo apt update --yes
sudo apt upgrade --yes
sudo apt install --yes software-properties-common
Expand Down
6 changes: 3 additions & 3 deletions terraform/aws/no-peering-deployment-root-aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ variable "owner" {
}

variable "zdm_linux_distro" {
default = "jammy"
default = "noble"

validation {
condition = can(regex("focal|jammy|centos7|centos8|centos9|rocky8|rocky9|rhel7|rhel8", var.zdm_linux_distro))
error_message = "Invalid Linux distro, allowed_values = [focal jammy centos7 centos8 centos9 rocky8 rocky9 rhel7 rhel8]."
condition = can(regex("focal|jammy|noble|centos7|centos8|centos9|rocky8|rocky9|rhel7|rhel8", var.zdm_linux_distro))
error_message = "Invalid Linux distro, allowed_values = [focal jammy noble centos7 centos8 centos9 rocky8 rocky9 rhel7 rhel8]."
}
}
6 changes: 3 additions & 3 deletions terraform/aws/self-contained-deployment-root-aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ variable "owner" {
}

variable "zdm_linux_distro" {
default = "jammy"
default = "noble"

validation {
condition = can(regex("focal|jammy|centos7|centos8|centos9|rocky8|rocky9|rhel7|rhel8", var.zdm_linux_distro))
error_message = "Invalid Linux distro, allowed_values = [focal jammy centos7 centos8 centos9 rocky8 rocky9 rhel7 rhel8]."
condition = can(regex("focal|jammy|noble|centos7|centos8|centos9|rocky8|rocky9|rhel7|rhel8", var.zdm_linux_distro))
error_message = "Invalid Linux distro, allowed_values = [focal jammy noble centos7 centos8 centos9 rocky8 rocky9 rhel7 rhel8]."
}
}
1 change: 1 addition & 0 deletions terraform/aws/submodules-aws/instances-aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ locals {
allowed_linux_distros = {
focal = { owner = "amazon", name_pattern = "ubuntu/images/*/ubuntu-*-20.04-*", linux_user = "ubuntu" }
jammy = { owner = "amazon", name_pattern = "ubuntu/images/*/ubuntu-*-22.04-*", linux_user = "ubuntu" }
noble = { owner = "amazon", name_pattern = "ubuntu/images/*/ubuntu-*-24.04-*", linux_user = "ubuntu" }
centos7 = { owner = "125523088429", name_pattern = "CentOS Linux 7*", linux_user = "centos" }
centos8 = { owner = "125523088429", name_pattern = "CentOS Stream 8*", linux_user = "centos" }
centos9 = { owner = "125523088429", name_pattern = "CentOS Stream 9*", linux_user = "ec2-user" }
Expand Down
6 changes: 3 additions & 3 deletions terraform/aws/submodules-aws/instances-aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ variable "custom_name_suffix" {}
variable "owner" {}

variable "zdm_linux_distro" {
default = "jammy"
default = "noble"

validation {
condition = can(regex("focal|jammy|centos7|centos8|centos9|rocky8|rocky9|rhel7|rhel8", var.zdm_linux_distro))
error_message = "Invalid Linux distro, allowed_values = [focal jammy centos7 centos8 centos9 rocky8 rocky9 rhel7 rhel8]."
condition = can(regex("focal|jammy|noble|centos7|centos8|centos9|rocky8|rocky9|rhel7|rhel8", var.zdm_linux_distro))
error_message = "Invalid Linux distro, allowed_values = [focal jammy noble centos7 centos8 centos9 rocky8 rocky9 rhel7 rhel8]."
}
}

0 comments on commit 3ae0728

Please sign in to comment.