From fff99644c7ea39060627136b4700890edf770f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enol=20Fern=C3=A1ndez?= Date: Fri, 23 Aug 2024 13:57:11 +0100 Subject: [PATCH] Remove old images (#83) * Remove old Ubuntu images * Avoid error when matrix is empty * Remove centOS images --- .github/workflows/build.yml | 2 + centos/README.md | 3 - centos/appdb/centos-7.yaml | 14 -- centos/appdb/centos-8.yaml | 14 -- centos/centos-7.json | 60 ----- centos/centos-8.json | 61 ------ centos/httpdir/centos-7.cfg.tpl | 31 --- centos/httpdir/centos-8.cfg.tpl | 40 ---- centos/provisioners/clean.yaml | 35 --- centos/provisioners/cleanup.sh | 6 - centos/provisioners/cloud-init.yaml | 33 --- centos/provisioners/config.yaml | 9 - centos/provisioners/init.yaml | 21 -- centos/provisioners/network-centos7.yaml | 32 --- centos/provisioners/network-centos8.yaml | 7 - 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 ------ 23 files changed, 2 insertions(+), 935 deletions(-) delete mode 100644 centos/README.md delete mode 100644 centos/appdb/centos-7.yaml delete mode 100644 centos/appdb/centos-8.yaml delete mode 100644 centos/centos-7.json delete mode 100644 centos/centos-8.json delete mode 100644 centos/httpdir/centos-7.cfg.tpl delete mode 100644 centos/httpdir/centos-8.cfg.tpl delete mode 100644 centos/provisioners/clean.yaml delete mode 100644 centos/provisioners/cleanup.sh delete mode 100644 centos/provisioners/cloud-init.yaml delete mode 100644 centos/provisioners/config.yaml delete mode 100644 centos/provisioners/init.yaml delete mode 100644 centos/provisioners/network-centos7.yaml delete mode 100644 centos/provisioners/network-centos8.yaml 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/.github/workflows/build.yml b/.github/workflows/build.yml index 9b98c2d..5293819 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-latest outputs: matrix: ${{ steps.change-list.outputs.all_changed_files }} + any_changed: ${{ steps.change-list.outputs.any_changed }} steps: - name: checkout code @@ -28,6 +29,7 @@ jobs: build-images: name: Image builder needs: image-list + if: ${{ needs.image-list.outputs.any_changed }} runs-on: ubuntu-latest strategy: # just run one build at a time diff --git a/centos/README.md b/centos/README.md deleted file mode 100644 index 066524e..0000000 --- a/centos/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# CentOS 7 - -Packer configuration for creating CentOS 6 and 7 ready for FedCloud. diff --git a/centos/appdb/centos-7.yaml b/centos/appdb/centos-7.yaml deleted file mode 100644 index 2038757..0000000 --- a/centos/appdb/centos-7.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -appdb: - version: 2024.01.02 - expireson: 6 - notes: CentOS 7 regular update - url: https://api.cloud.ifca.es:8080/swift/v1/egi_endorsed_vas/centos.7-2024.01.02.ova - sha512: "84deb94d30947059bf70753c87dcaf6040ee298fd094a78be872772412a397b92c65853397d2fe805916edc6659350be533ac52d42ff6d95abf5e17d8e5351a7" - arch: x86_64 - os: - family: Linux - name: CentOS - version: '7' - format: OVA - hypervisor: VirtualBox diff --git a/centos/appdb/centos-8.yaml b/centos/appdb/centos-8.yaml deleted file mode 100644 index 3bee946..0000000 --- a/centos/appdb/centos-8.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -appdb: - version: 2024.03.22 - expireson: 3 - notes: Regular update - url: https://api.cloud.ifca.es:8080/swift/v1/egi_endorsed_vas/centos.8-2024.03.22.ova - sha512: "d61dc56adb240a6a855985a673cd7b8545af38254f3bec2caf0fe434c9541a20dce887154c77cbce9d6f8eccc3796d9aa95679f11602aa3ba51236f78cee6e7c" - arch: x86_64 - os: - family: Linux - name: CentOS - version: '8' - format: OVA - hypervisor: VirtualBox diff --git a/centos/centos-7.json b/centos/centos-7.json deleted file mode 100644 index 6bfcf56..0000000 --- a/centos/centos-7.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "variables": { - "SSH_PUB_KEY": "", - "SSH_PRIVATE_KEY_FILE": "" - }, - "builders": [ - { - "boot_command": [ - "", - " linux ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos-7.cfg", - "" - ], - "disk_size": 8000, - "format": "qcow2", - "headless": true, - "http_directory": "httpdir", - "http_port_max": 8550, - "http_port_min": 8500, - "iso_checksum": "sha256:b79079ad71cc3c5ceb3561fff348a1b67ee37f71f4cddfec09480d4589c191d6", - "iso_url": "https://mirror.netcologne.de/centos/7/isos/x86_64/CentOS-7-x86_64-NetInstall-2009.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": "centos.7-2024.01.02" - } - ], - "provisioners": [ - { - "playbook_file": "provisioners/init.yaml", - "use_proxy": false, - "type": "ansible" - }, - { - "expect_disconnect": true, - "inline": [ - "reboot \u0026", - "sleep 5s" - ], - "type": "shell" - }, - { - "pause_before": "30s", - "playbook_file": "provisioners/config.yaml", - "use_proxy": false, - "type": "ansible" - }, - { - "type": "shell", - "script": "provisioners/cleanup.sh" - } - ] -} - diff --git a/centos/centos-8.json b/centos/centos-8.json deleted file mode 100644 index aebf105..0000000 --- a/centos/centos-8.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "variables": { - "SSH_PUB_KEY": "", - "SSH_PRIVATE_KEY_FILE": "" - }, - "builders": [ - { - "boot_command": [ - "", - "linux inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/centos-8.cfg", - "" - ], - "boot_wait": "3s", - "disk_size": 8000, - "format": "qcow2", - "headless": true, - "http_directory": "httpdir", - "http_port_max": 8550, - "http_port_min": 8500, - "iso_checksum": "sha256:7b4689d1ba47c916db43d16aa6badb1f001c4ad3efc26c88202d9401c3037faf", - "iso_url": "http://ftp.wrz.de/pub/CentOS/8-stream/isos/x86_64/CentOS-Stream-8-x86_64-latest-boot.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": "centos.8-2024.03.22" - } - ], - "provisioners": [ - { - "playbook_file": "provisioners/init.yaml", - "use_proxy": false, - "type": "ansible" - }, - { - "expect_disconnect": true, - "inline": [ - "reboot", - "sleep 5s" - ], - "type": "shell" - }, - { - "pause_before": "30s", - "playbook_file": "provisioners/config.yaml", - "use_proxy": false, - "type": "ansible" - }, - { - "type": "shell", - "script": "provisioners/cleanup.sh" - } - ] -} - diff --git a/centos/httpdir/centos-7.cfg.tpl b/centos/httpdir/centos-7.cfg.tpl deleted file mode 100644 index b8929cf..0000000 --- a/centos/httpdir/centos-7.cfg.tpl +++ /dev/null @@ -1,31 +0,0 @@ -install -url --url=http://mirror.nextlayer.at/centos/7/os/x86_64/ -lang en_US.UTF-8 -keyboard us -network --device=eth0 --bootproto dhcp --onboot=yes --noipv6 -rootpw --lock rootpassword -firewall --enabled --service=ssh -authconfig --enableshadow --passalgo=sha512 -selinux --disabled -timezone UTC -bootloader --location=mbr -text -skipx -zerombr -clearpart --all --initlabel -part / --size=1 --grow --fstype ext4 -auth --useshadow --enablemd5 -firstboot --disabled -reboot -%packages --nobase -@core -openssh-clients -openssh-server -%end -%post -/usr/bin/yum -y install sudo -sed 's/^[#[:space:]]*PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config -mkdir -p /root/.ssh -/bin/sh -c "echo '%SSH_KEY%' > /root/.ssh/authorized_keys" -chmod 400 /root/.ssh/authorized_keys -%end diff --git a/centos/httpdir/centos-8.cfg.tpl b/centos/httpdir/centos-8.cfg.tpl deleted file mode 100644 index bad07ec..0000000 --- a/centos/httpdir/centos-8.cfg.tpl +++ /dev/null @@ -1,40 +0,0 @@ - - -lang en_US.UTF-8 -keyboard --vckeymap=us --xlayouts='us' -network --bootproto=dhcp --device=link --activate -# network installation -url --mirrorlist="http://mirrorlist.centos.org/?release=8-stream&arch=x86_64&repo=BaseOS&infra=$infra" -rootpw --plaintext rootpassword - -firewall --enabled --service=ssh -selinux --disabled -timezone UTC -bootloader --location=mbr -text -skipx - -zerombr -clearpart --all --initlabel -part / --size=1 --grow --fstype ext4 -firstboot --disabled -reboot - -%packages -@^minimal-environment -openssh-clients -openssh-server -sudo -kexec-tools -%end - -%post -/usr/bin/yum -y install sudo -sed 's/^[#[:space:]]*PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config -mkdir -p /root/.ssh -/bin/sh -c "echo '%SSH_KEY%' > /root/.ssh/authorized_keys" -chmod 400 /root/.ssh/authorized_keys -%end - -%addon com_redhat_kdump --enable --reserve-mb='auto' -%end diff --git a/centos/provisioners/clean.yaml b/centos/provisioners/clean.yaml deleted file mode 100644 index 6fa3d80..0000000 --- a/centos/provisioners/clean.yaml +++ /dev/null @@ -1,35 +0,0 @@ ---- -- name: remote ssh keys - file: - path: "{{ item }}" - state: absent - with_fileglob: - - "/etc/ssh/ssh_host_*" - -- name: disable root login - lineinfile: - path: /etc/ssh/sshd_config - regexp: '^PermitRootLogin.*' - line: 'PermitRootLogin no' - -- name: disable pasword authentication - lineinfile: - path: /etc/ssh/sshd_config - regexp: '^#\?PasswordAuthentication.*' - line: 'PasswordAuthentication no' - -- name: lock root password - command: passwd -l root - -- name: remove unneeded files - file: - path: "{{ item }}" - state: absent - loop: - - /root/.bash_history - - /root/VBoxGuestAdditions.iso - -- name: fill disk with zeros - shell: | - dd if=/dev/zero of=/bigemptyfile bs=4096k count=2 || echo "full disk" - rm -rf /bigemptyfile diff --git a/centos/provisioners/cleanup.sh b/centos/provisioners/cleanup.sh deleted file mode 100644 index 7fefa22..0000000 --- a/centos/provisioners/cleanup.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -x - -# Clean up leftover build files -sudo rm -fr /home/*/{.ssh,.ansible,.cache} -sudo rm -fr /root/{.ssh,.ansible,.cache} -sudo rm -fr /root/'~'* diff --git a/centos/provisioners/cloud-init.yaml b/centos/provisioners/cloud-init.yaml deleted file mode 100644 index 4761a88..0000000 --- a/centos/provisioners/cloud-init.yaml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- name: install epel - yum: - name: epel-release - state: latest - when: ansible_distribution_major_version != "8" - -- name: install cloud-init and extra packages - yum: - name: [cloud-init, cloud-utils-growpart] - state: latest - -- name: Create fedcloud config - copy: - content: | - # EGI FedCloud configuration - - # Make sure to disable ssh password authentication - ssh_pwauth: 0 - # Regenerate keys - ssh_deletekeys: True - ssh_genkeytypes: ['rsa', 'dsa'] - dest: /etc/cloud/cloud.cfg.d/01_fedcloud.cfg - -- name: enable service - service: - name: "{{ item }}" - enabled: yes - loop: - - cloud-init-local - - cloud-init - - cloud-config - - cloud-final diff --git a/centos/provisioners/config.yaml b/centos/provisioners/config.yaml deleted file mode 100644 index c790046..0000000 --- a/centos/provisioners/config.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- hosts: all - tasks: - - name: Include cloud-init recipe - include_tasks: cloud-init.yaml - - name: Include "{{ansible_distribution_major_version}}" network recipe - include_tasks: "network-centos{{ansible_distribution_major_version}}.yaml" - - name: Include clean-up recipe - include_tasks: clean.yaml diff --git a/centos/provisioners/init.yaml b/centos/provisioners/init.yaml deleted file mode 100644 index 46d3575..0000000 --- a/centos/provisioners/init.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- hosts: all - gather_facts: False - tasks: - - name: install python - raw: test -e /usr/bin/python || test -e /usr/bin/python3 || (yum install -y python39) - -- hosts: all - tasks: - - name: update packages - yum: - name: '*' - state: latest - - name: get the rpm package facts - package_facts: - manager: "auto" - - name: Rebuilding initramfs for kernel - command: | - dracut -f --no-hostonly /boot/initramfs-{{ item['version'] }}-{{ item['release'] }}.{{ item['arch'] }}.img - {{ item['version'] }}-{{ item['release'] }}.{{ item['arch'] }} - loop: "{{ ansible_facts.packages['kernel'] }}" diff --git a/centos/provisioners/network-centos7.yaml b/centos/provisioners/network-centos7.yaml deleted file mode 100644 index f462b24..0000000 --- a/centos/provisioners/network-centos7.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- name: Create /etc/sysconfig/network - copy: - content: | - NETWORKING=yes - NOZEROCONF=yes - dest: /etc/sysconfig/network - -- name: Create /etc/sysconfig/network-scripts/ifcfg-eth0 - copy: - content: | - DEVICE="eth0" - BOOTPROTO="dhcp" - ONBOOT="yes" - TYPE="Ethernet" - USERCTL="yes" - PEERDNS="yes" - IPV6INIT="no" - PERSISTENT_DHCLIENT="1" - dest: /etc/sysconfig/network-scripts/ifcfg-eth0 - -- name: enable network service - service: - name: network - state: started - enabled: yes - -- name: disable network manager - service: - name: NetworkManager - state: stopped - enabled: no diff --git a/centos/provisioners/network-centos8.yaml b/centos/provisioners/network-centos8.yaml deleted file mode 100644 index ef1094c..0000000 --- a/centos/provisioners/network-centos8.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Create /etc/sysconfig/network - copy: - content: | - NETWORKING=yes - NOZEROCONF=yes - dest: /etc/sysconfig/network 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" - } - ] -}