From 90d27412ea442e44b53e1c35234510e621888713 Mon Sep 17 00:00:00 2001 From: Enol Fernandez Date: Thu, 8 Aug 2024 09:26:28 +0100 Subject: [PATCH] Remove old Ubuntu images --- ubuntu/appdb/ubuntu-18.04.yaml | 14 -- ubuntu/jupyterhub-ubuntu-16.04.json | 57 ----- ubuntu/provisioners/jupyterhub.yaml | 156 ------------- .../cloud-init/files/cloud-init-trusty.patch | 207 ------------------ .../cloud-init/files/cloud-init-xenial.patch | 15 -- .../cloud-init/tasks/cloud-init-trusty.yaml | 26 --- .../cloud-init/tasks/cloud-init-xenial.yaml | 29 --- ubuntu/ubuntu-18.04.json | 65 ------ 8 files changed, 569 deletions(-) delete mode 100644 ubuntu/appdb/ubuntu-18.04.yaml delete mode 100644 ubuntu/jupyterhub-ubuntu-16.04.json delete mode 100644 ubuntu/provisioners/jupyterhub.yaml delete mode 100644 ubuntu/provisioners/roles/cloud-init/files/cloud-init-trusty.patch delete mode 100644 ubuntu/provisioners/roles/cloud-init/files/cloud-init-xenial.patch delete mode 100644 ubuntu/provisioners/roles/cloud-init/tasks/cloud-init-trusty.yaml delete mode 100644 ubuntu/provisioners/roles/cloud-init/tasks/cloud-init-xenial.yaml delete mode 100644 ubuntu/ubuntu-18.04.json diff --git a/ubuntu/appdb/ubuntu-18.04.yaml b/ubuntu/appdb/ubuntu-18.04.yaml deleted file mode 100644 index c0a565a..0000000 --- a/ubuntu/appdb/ubuntu-18.04.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -appdb: - version: 2023.07.13 - expireson: 6 - notes: Ubuntu 18.04 is now EOL. This image will be removed once the current version expires - url: https://api.cloud.ifca.es:8080/swift/v1/egi_endorsed_vas/Ubuntu.18.04-2023.07.13.ova - sha512: "48000ea497da73967a3a83a5a2f8660761ab43ba0bb1abf6d155f556f9ad30dd2545cc80cfc6e290091eba37ede87ef1c7311ad2ec7c26a5f20a65090833a75e" - arch: x86_64 - os: - family: Linux - name: Ubuntu - version: '18.04' - format: OVA - hypervisor: VirtualBox diff --git a/ubuntu/jupyterhub-ubuntu-16.04.json b/ubuntu/jupyterhub-ubuntu-16.04.json deleted file mode 100644 index 4afcef8..0000000 --- a/ubuntu/jupyterhub-ubuntu-16.04.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "builders": [{ - "type": "virtualbox-iso", - "guest_os_type": "Ubuntu_64", - "disk_size": 8000, - "iso_url": "http://archive.ubuntu.com/ubuntu/dists/xenial/main/installer-amd64/current/images/netboot/mini.iso", - "iso_checksum": "655d1ec0a7415b4d963e7f2c40e3d56bd135907dda2cedd0c75209ced3a63103", - "iso_checksum_type": "sha256", - "ssh_username": "root", - "ssh_password": "rootpasswd", - "ssh_wait_timeout": "90m", - "shutdown_command": "shutdown -h now", - "http_directory": "httpdir", - "http_port_min": 8500, - "http_port_max": 8550, - "boot_command": [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "linux ", - "auto=true priority=critical ", - "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/ubuntu.cfg ", - "initrd=initrd.gz ---", - "" - ], - "format": "ova", - "vm_name": "JupyterHub.Ubuntu.16.04-2019.02.12" - }], - "provisioners": [ - { - "type": "ansible", - "playbook_file": "provisioners/init.yaml" - }, - { - "type": "shell", - "expect_disconnect": true, - "inline": [ - "#!/usr/bin/env bash", - "set -uex", - "(sleep 2s; shutdown --reboot now) &", - "service ssh restart" - ] - }, - { - "type": "ansible", - "playbook_file": "provisioners/jupyterhub.yaml", - "pause_before": "30s" - } - ] -} diff --git a/ubuntu/provisioners/jupyterhub.yaml b/ubuntu/provisioners/jupyterhub.yaml deleted file mode 100644 index b7a195d..0000000 --- a/ubuntu/provisioners/jupyterhub.yaml +++ /dev/null @@ -1,156 +0,0 @@ ---- -- hosts: all - tasks: - - name: Include cloud-init recipe - include_tasks: cloud-init.yaml - -- hosts: all - vars: - docker_version: 17.03.2~ce-0~ubuntu-xenial - tasks: - - name: install requirements - apt: - name: - - apt-transport-https - - ca-certificates - - curl - - software-properties-common - - "linux-image-extra-{{ ansible_kernel }}" - - apparmor - state: latest - - name: add Docker repo key - apt_key: url="https://download.docker.com/linux/debian/gpg" - ignore_errors: yes - - name: add docker repo - apt_repository: - repo: 'deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ansible_distribution_release}} stable' - state: present - update_cache: yes - - name: Install docker {{ docker_version }} - apt: - name: "docker-ce={{ docker_version }}" - state: present - force: yes - -# notebooks -- hosts: all - tasks: - - name: add node repo key - apt_key: url="https://deb.nodesource.com/gpgkey/nodesource.gpg.key" - ignore_errors: yes - - name: add node repo - apt_repository: - repo: 'deb [arch=amd64] https://deb.nodesource.com/node_11.x xenial main' - state: present - update_cache: yes - - name: install packages - apt: - name: - - nginx - - python3-pip - - nodejs - state: present - - name: install python packages - pip: - executable: pip3 - name: "jupyterhub dockerspawner jupyter_client git+https://github.com/enolfc/egispawner.git git+https://github.com/enolfc/oauthenticator.git@checkin" - - name: Install "configurable-http-proxy" node.js package globally. - npm: - name: configurable-http-proxy - global: yes - - name: Create dirs - file: - path: "{{ item }}" - state: directory - with_items: [/etc/jupyterhub, /var/lib/jupyterhub] - - name: Create jupyterhub_config.py file - copy: - dest: /etc/jupyterhub/jupyterhub_config.py - content: | - from jupyter_client.localinterfaces import public_ips - c.JupyterHub.hub_ip = public_ips()[0] - - c.JupyterHub.cookie_secret_file = '/var/lib/jupyterhub/jupyterhub_cookie_secret' - c.JupyterHub.db_url = 'sqlite:////var/lib/jupyterhub/jupyterhub.sqlite' - - import os - os.environ['EGICHECKIN_HOST'] = 'aai-dev.egi.eu' - c.JupyterHub.authenticator_class = 'oauthenticator.egicheckin.EGICheckinAuthenticator' - c.EGICheckinAuthenticator.client_id = '' - c.EGICheckinAuthenticator.client_secret = '' - c.EGICheckinAuthenticator.oauth_callback_url = 'https:///hub/oauth_callback' - c.EGICheckinAuthenticator.scope = ['openid', 'profile', 'email', 'offline_access', - 'eduperson_scoped_affiliation', 'eduperson_entitlement'] - c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner' - notebook_dir = os.environ.get('DOCKER_NOTEBOOK_DIR') or '/home/jovyan/work' - c.DockerSpawner.notebook_dir = notebook_dir - c.DockerSpawner.image = 'jupyter/scipy-notebook:latest' - c.DockerSpawner.volumes = { 'jupyterhub-user-{username}': notebook_dir } - c.DockerSpawner.remove_containers = True - c.Spawner.default_url = '/lab' - - name: Create nginx connection.conf file - copy: - dest: /etc/nginx/conf.d/connection.conf - content: | - map $http_upgrade $connection_upgrade { - default upgrade; - '' close; - } - - name: remove default nginx site - file: - path: /etc/nginx/sites-enabled/default - state: absent - - name: Proxy jupyterhub in nginx conf - copy: - dest: /etc/nginx/sites-enabled/jupyterhub - content: | - server { - listen 80 default_server; - listen [::]:80 default_server; - - root /var/www/html; - - # Add index.php to the list if you are using PHP - index index.html index.htm index.nginx-debian.html; - - server_name _; - - # Managing literal requests to the JupyterHub front end - location / { - proxy_pass http://localhost:8000; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header Host $host; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - - # websocket headers - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $connection_upgrade; - } - } - - name: Create systemd for jupyterhub - copy: - dest: /etc/systemd/system/jupyterhub.service - content: | - [Unit] - Description=Jupyterhub - After=syslog.target network.target - - [Service] - User=root - ExecStart=/usr/local/bin/jupyterhub -f /etc/jupyterhub/jupyterhub_config.py - - [Install] - WantedBy=multi-user.target - - name: Enable services - service: - name: "{{ item }}" - enabled: yes - with_items: - - nginx - - jupyterhub - -- hosts: all - tasks: - - name: Include clean-up recipe - include_tasks: clean.yaml - diff --git a/ubuntu/provisioners/roles/cloud-init/files/cloud-init-trusty.patch b/ubuntu/provisioners/roles/cloud-init/files/cloud-init-trusty.patch deleted file mode 100644 index 481e23e..0000000 --- a/ubuntu/provisioners/roles/cloud-init/files/cloud-init-trusty.patch +++ /dev/null @@ -1,207 +0,0 @@ -diff -Naur distros_orig/debian.py distros/debian.py ---- distros_orig/debian.py 2014-04-01 20:26:07.000000000 +0200 -+++ distros/debian.py 2017-01-10 12:31:16.182469360 +0100 -@@ -74,19 +74,29 @@ - self.update_package_sources() - self.package_command('install', pkgs=pkglist) - -- def _write_network(self, settings): -- util.write_file(self.network_conf_fn, settings) -+ def _write_network(self, settings, do_write=True): -+ if do_write: -+ util.write_file(self.network_conf_fn, settings) - return ['all'] - -- def _bring_up_interfaces(self, device_names): -+ def _bring_interfaces(self, device_names, action): - use_all = False - for d in device_names: - if d == 'all': - use_all = True - if use_all: -- return distros.Distro._bring_up_interface(self, '--all') -+ return action(self, '--all') - else: -- return distros.Distro._bring_up_interfaces(self, device_names) -+ return action(self, device_names) -+ -+ def _bring_up_interfaces(self, device_names): -+ return self._bring_interfaces(device_names, -+ distros.Distro._bring_up_interface) -+ -+ def _bring_down_interfaces(self, device_names): -+ return self._bring_interfaces(device_names, -+ distros.Distro._bring_down_interface) -+ - - def _select_hostname(self, hostname, fqdn): - # Prefer the short hostname over the long -diff -Naur distros_orig/__init__.py distros/__init__.py ---- distros_orig/__init__.py 2016-11-25 13:21:28.000000000 +0100 -+++ distros/__init__.py 2017-01-10 12:32:28.898469360 +0100 -@@ -67,7 +67,7 @@ - raise NotImplementedError() - - @abc.abstractmethod -- def _write_network(self, settings): -+ def _write_network(self, settings, do_write=True): - # In the future use the http://fedorahosted.org/netcf/ - # to write this blob out in a distro format - raise NotImplementedError() -@@ -115,6 +115,9 @@ - mirror_info=arch_info) - - def apply_network(self, settings, bring_up=True): -+ if bring_up: -+ dev_names = self._write_network(settings, do_write=False) -+ self._bring_down_interfaces(dev_names) - # Write it out - dev_names = self._write_network(settings) - # Now try to bring them up -@@ -269,9 +272,9 @@ - contents.write("%s\n" % (eh)) - util.write_file(self.hosts_fn, contents.getvalue(), mode=0644) - -- def _bring_up_interface(self, device_name): -- cmd = ['ifup', device_name] -- LOG.debug("Attempting to run bring up interface %s using command %s", -+ def _bring_interface(self, device_name, command): -+ cmd = [command, device_name] -+ LOG.debug("Attempting to manage interface %s using command %s", - device_name, cmd) - try: - (_out, err) = util.subp(cmd) -@@ -282,15 +285,27 @@ - util.logexc(LOG, "Running interface command %s failed", cmd) - return False - -- def _bring_up_interfaces(self, device_names): -+ def _bring_up_interface(self, device_name): -+ return self._bring_interface(device_name, 'ifup') -+ -+ def _bring_down_interface(self, device_name): -+ return self._bring_interface(device_name, 'ifdown') -+ -+ def _bring_interfaces(self, device_names, action): - am_failed = 0 - for d in device_names: -- if not self._bring_up_interface(d): -+ if not action(d): - am_failed += 1 - if am_failed == 0: - return True - return False - -+ def _bring_up_interfaces(self, device_names): -+ return self._bring_interfaces(device_names, self._bring_up_interface) -+ -+ def _bring_down_interfaces(self, device_names): -+ return self._bring_interfaces(device_names, self._bring_down_interface) -+ - def get_default_user(self): - return self.get_option('default_user') - -diff -Naur distros_orig/rhel.py distros/rhel.py ---- distros_orig/rhel.py 2014-04-01 20:26:07.000000000 +0200 -+++ distros/rhel.py 2017-01-10 12:31:16.186469360 +0100 -@@ -62,7 +62,7 @@ - def install_packages(self, pkglist): - self.package_command('install', pkgs=pkglist) - -- def _write_network(self, settings): -+ def _write_network(self, settings, do_write=True): - # TODO(harlowja) fix this... since this is the ubuntu format - entries = net_util.translate_network(settings) - LOG.debug("Translated ubuntu style network settings %s into %s", -@@ -83,15 +83,16 @@ - 'MACADDR': info.get('hwaddress'), - 'ONBOOT': _make_sysconfig_bool(info.get('auto')), - } -- rhel_util.update_sysconfig_file(net_fn, net_cfg) -+ if do_write: -+ rhel_util.update_sysconfig_file(net_fn, net_cfg) - if 'dns-nameservers' in info: - nameservers.extend(info['dns-nameservers']) - if 'dns-search' in info: - searchservers.extend(info['dns-search']) -- if nameservers or searchservers: -+ if (nameservers or searchservers) and do_write: - rhel_util.update_resolve_conf_file(self.resolve_conf_fn, - nameservers, searchservers) -- if dev_names: -+ if dev_names and do_write: - net_cfg = { - 'NETWORKING': _make_sysconfig_bool(True), - } -@@ -155,11 +156,19 @@ - else: - return default - -- def _bring_up_interfaces(self, device_names): -+ def _bring_interfaces(self, device_names, action): - if device_names and 'all' in device_names: - raise RuntimeError(('Distro %s can not translate ' - 'the device name "all"') % (self.name)) -- return distros.Distro._bring_up_interfaces(self, device_names) -+ return action(self, device_names) -+ -+ def _bring_up_interfaces(self, device_names): -+ return self._bring_interfaces(device_names, -+ distros.Distro._bring_up_interfaces) -+ -+ def _bring_down_interfaces(self, device_names): -+ return self._bring_interfaces(device_names, -+ distros.Distro._bring_down_interfaces) - - def set_timezone(self, tz): - tz_file = self._find_tz_file(tz) -diff -Naur distros_orig/sles.py distros/sles.py ---- distros_orig/sles.py 2014-04-01 20:26:07.000000000 +0200 -+++ distros/sles.py 2017-01-10 12:31:16.186469360 +0100 -@@ -53,7 +53,7 @@ - def install_packages(self, pkglist): - self.package_command('install', args='-l', pkgs=pkglist) - -- def _write_network(self, settings): -+ def _write_network(self, settings, do_write=True): - # Convert debian settings to ifcfg format - entries = net_util.translate_network(settings) - LOG.debug("Translated ubuntu style network settings %s into %s", -@@ -84,12 +84,13 @@ - net_cfg['ETHTOOL_OPTIONS'] = '' - else: - net_cfg['FIREWALL'] = 'no' -- rhel_util.update_sysconfig_file(net_fn, net_cfg, True) -+ if do_write: -+ rhel_util.update_sysconfig_file(net_fn, net_cfg, True) - if 'dns-nameservers' in info: - nameservers.extend(info['dns-nameservers']) - if 'dns-search' in info: - searchservers.extend(info['dns-search']) -- if nameservers or searchservers: -+ if (nameservers or searchservers) and do_write: - rhel_util.update_resolve_conf_file(self.resolve_conf_fn, - nameservers, searchservers) - return dev_names -@@ -142,11 +143,19 @@ - return default - return hostname - -- def _bring_up_interfaces(self, device_names): -+ def _bring_interfaces(self, device_names): - if device_names and 'all' in device_names: - raise RuntimeError(('Distro %s can not translate ' - 'the device name "all"') % (self.name)) -- return distros.Distro._bring_up_interfaces(self, device_names) -+ return cb(self, device_names) -+ -+ def _bring_up_interfaces(self, device_names): -+ return self._bring_interfaces(device_names, -+ distros.Distro._bring_up_interfaces) -+ -+ def _bring_down_interfaces(self, device_names): -+ return self._bring_interfaces(device_names, -+ distros.Distro._bring_down_interfaces) - - def set_timezone(self, tz): - tz_file = self._find_tz_file(tz) diff --git a/ubuntu/provisioners/roles/cloud-init/files/cloud-init-xenial.patch b/ubuntu/provisioners/roles/cloud-init/files/cloud-init-xenial.patch deleted file mode 100644 index 80fb1d6..0000000 --- a/ubuntu/provisioners/roles/cloud-init/files/cloud-init-xenial.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- eni.py 2018-04-04 00:52:13.000000000 +0200 -+++ eni.py.new 2018-05-29 13:35:51.587281111 +0200 -@@ -451,6 +451,12 @@ - - if iface.get('name') == "lo": - continue -+ -+ if nameservers: -+ iface['subnets'][0]["dns_nameservers"] = (" ".join(nameservers)) -+ if searchdomains: -+ iface['subnets'][0]["dns_search"] = (" ".join(searchdomains)) -+ - sections.extend( - self._render_iface(iface, render_hwaddress=render_hwaddress)) - diff --git a/ubuntu/provisioners/roles/cloud-init/tasks/cloud-init-trusty.yaml b/ubuntu/provisioners/roles/cloud-init/tasks/cloud-init-trusty.yaml deleted file mode 100644 index 8740437..0000000 --- a/ubuntu/provisioners/roles/cloud-init/tasks/cloud-init-trusty.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: install patch - apt: - name: patch - state: latest - -- name: copy cloud-init patch - copy: - src: cloud-init-trusty.patch - dest: /tmp/cloud-init.patch - -- name: patch cloud-init - shell: | - set -uexo pipefail - pushd /usr/lib/python2.7/dist-packages/cloudinit/distros/ - patch -p 1 < /tmp/cloud-init.patch - popd - # Create .pyc files - rm /usr/lib/python2.7/dist-packages/cloudinit/distros/__init__.pyc \ - /usr/lib/python2.7/dist-packages/cloudinit/distros/debian.pyc \ - /usr/lib/python2.7/dist-packages/cloudinit/distros/rhel.pyc \ - /usr/lib/python2.7/dist-packages/cloudinit/distros/sles.pyc - python -c "import cloudinit.distros.debian; import cloudinit.distros.rhel; import cloudinit.distros.sles" - rm /tmp/cloud-init.patch - args: - executable: /bin/bash diff --git a/ubuntu/provisioners/roles/cloud-init/tasks/cloud-init-xenial.yaml b/ubuntu/provisioners/roles/cloud-init/tasks/cloud-init-xenial.yaml deleted file mode 100644 index 6b263ec..0000000 --- a/ubuntu/provisioners/roles/cloud-init/tasks/cloud-init-xenial.yaml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- name: install patch - apt: - name: patch - state: latest - -- name: copy cloud-init patch - copy: - src: cloud-init-xenial.patch - dest: /tmp/cloud-init.patch - -- name: patch cloud-init - shell: | - set -uexo pipefail - pushd /usr/lib/python3/dist-packages/cloudinit/net/ - patch < /tmp/cloud-init.patch || exit 1 - rm /tmp/cloud-init.patch - popd - python3 -c "import cloudinit.net.eni" - args: - executable: /bin/bash - -- name: remove network configuration - replace: - path: /etc/network/interfaces - regexp: "^[^#](.*{{ item }}.*)$" - replace: '# \1' - when: item != "lo" - loop: "{{ ansible_interfaces }}" diff --git a/ubuntu/ubuntu-18.04.json b/ubuntu/ubuntu-18.04.json deleted file mode 100644 index 78eb52a..0000000 --- a/ubuntu/ubuntu-18.04.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "variables": { - "SSH_PUB_KEY": "", - "SSH_PRIVATE_KEY_FILE": "" - }, - "builders": [ - { - "boot_command": [ - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "linux ", - "auto=true priority=critical ", - "preseed/url=http://{{.HTTPIP}}:{{.HTTPPort}}/ubuntu.cfg ", - "initrd=initrd.gz ---", - "" - ], - "disk_size": 8000, - "format": "qcow2", - "headless": true, - "http_directory": "httpdir", - "http_port_max": 8550, - "http_port_min": 8500, - "iso_checksum": "sha256:bed8a55ae2a657f8349fe3271097cff3a5b8c3d1048cf258568f1601976fa30d", - "iso_url": "http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/mini.iso", - "memory": 1024, - "shutdown_command": "shutdown -h now", - "ssh_clear_authorized_keys": true, - "ssh_private_key_file": "{{ user `SSH_PRIVATE_KEY_FILE` }}", - "ssh_timeout": "90m", - "ssh_username": "root", - "type": "qemu", - "qemuargs": [ - [ "-cpu", "host" ] - ], - "vm_name": "Ubuntu.18.04-2023.07.13" - } - ], - "provisioners": [ - { - "playbook_file": "provisioners/init.yaml", - "type": "ansible", - "use_proxy": false, - "user": "root" - }, - { - "pause_before": "30s", - "playbook_file": "provisioners/base.yaml", - "type": "ansible", - "use_proxy": false, - "user": "root" - }, - { - "type": "shell", - "script": "provisioners/cleanup.sh" - } - ] -}