From 50ccab8738f1e566fe492f605960b801d4636c2a Mon Sep 17 00:00:00 2001 From: Olivier Date: Sun, 13 Oct 2024 15:18:43 +0200 Subject: [PATCH] Changement cubic > firstboot --- README.md | 3 +- ansible/{cubic.yml => firstboot.yml} | 4 +- autoinstall.yaml | 154 +++++++++++++++++++++++++++ autoinstall.yml | 55 ---------- config.yml | 8 +- 5 files changed, 162 insertions(+), 62 deletions(-) rename ansible/{cubic.yml => firstboot.yml} (75%) create mode 100644 autoinstall.yaml delete mode 100644 autoinstall.yml diff --git a/README.md b/README.md index d815306..6f35825 100644 --- a/README.md +++ b/README.md @@ -55,11 +55,12 @@ ansible-playbook configure-preseed.yml * Dans ce shell, taper les commandes suivantes : ```bash +apt update apt install -y git python3-poetry cd /opt git clone https://git.libretic.fr/libretic/libreticmenu.git cd libreticmenu -./libreticmenu.sh --cubic +./libreticmenu.sh --firstboot ``` * Une fois exécutées les commandes ci-dessus, passer à l'écran qui suit, qui propose de modifier la liste des packages qui doivent être supprimés dans l'image. Ne rien changer. diff --git a/ansible/cubic.yml b/ansible/firstboot.yml similarity index 75% rename from ansible/cubic.yml rename to ansible/firstboot.yml index 1d2112c..acc05ae 100644 --- a/ansible/cubic.yml +++ b/ansible/firstboot.yml @@ -1,8 +1,8 @@ # -# Ce playbook est à faire dans le modèle cubic +# Ce playbook est à exécuter pour forcer la configuration au prochain démarrage # -- name: Préparation de l'installation dans cubic +- name: Préparation de la configuration au prochain démarrage hosts: localhost vars_files: - main.yml diff --git a/autoinstall.yaml b/autoinstall.yaml new file mode 100644 index 0000000..7cef5d0 --- /dev/null +++ b/autoinstall.yaml @@ -0,0 +1,154 @@ +#cloud-config +autoinstall: + # version is an Autoinstall required field. + version: 1 + + # This adds the default ubuntu-desktop packages to the system. + # Any desired additional packages may also be listed here. + packages: + - ubuntu-desktop + + # This adds the default snaps found on a 22.04 Ubuntu Desktop system. + # Any desired additional snaps may also be listed here. + snaps: + - name: firefox + - name: gnome-3-38-2004 + - name: gtk-common-themes + - name: snap-store + - name: snapd-desktop-integration + + # User creation can occur in one of 3 ways: + # 1. Create a user using this `identity` section. + # 2. Create users as documented in cloud-init inside the user-data section, + # which means this single-user identity section may be removed. + # 3. Prompt for user configuration on first boot. Remove this identity + # section and see the "Installation without a default user" section. + identity: + realname: '' + username: ubuntu + # A password hash is needed. `mkpasswd --method=SHA-512` can help. + # mkpasswd can be found in the package 'whois' + password: '$6$f4PIJ90vUAym03vR$whABDyawYCLkP.bsbnF6Zv.twohtxP8aa1p/ClLaNyI2U75NSOj.XE5OqicsXfwgKhSUBaxazuNcB7IHckPw01' + hostname: ubuntu-desktop + + # Subiquity will, by default, configure a partition layout using LVM. + # The 'direct' layout method shown here will produce a non-LVM result. + storage: + layout: + name: direct + + # Ubuntu Desktop uses the hwe flavor kernel by default. + early-commands: + - echo 'linux-generic-hwe-22.04' > /run/kernel-meta-package + + # The live-server ISO does not contain some of the required packages, + # such as ubuntu-desktop or the hwe kernel (or most of their depdendencies). + # The system being installed will need some sort of apt access. + # proxy: http://192.168.0.1:3142 + + late-commands: + # Enable the boot splash + - >- + curtin in-target -- + sed -i /etc/default/grub -e + 's/GRUB_CMDLINE_LINUX_DEFAULT=".*/GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"/' + - curtin in-target -- update-grub + + # Let NetworkManager handle network + - rm /target/etc/netplan/00-installer-config*yaml + - >- + printf "network:\n version: 2\n renderer: NetworkManager" + > /target/etc/netplan/01-network-manager-all.yaml + + # Remove default filesystem and related tools not used with the suggested + # 'direct' storage layout. These may yet be required if different + # partitioning schemes are used. + - >- + curtin in-target -- apt-get remove -y + btrfs-progs cryptsetup* lvm2 xfsprogs + + # Remove other packages present by default in Ubuntu Server but not + # normally present in Ubuntu Desktop. + - >- + curtin in-target -- apt-get remove -y + ubuntu-server ubuntu-server-minimal + binutils byobu curl dmeventd finalrd gawk + kpartx mdadm ncurses-term needrestart open-iscsi openssh-server + sg3-utils ssh-import-id sssd thin-provisioning-tools vim tmux + sosreport screen open-vm-tools motd-news-config lxd-agent-loader + landscape-common htop git fonts-ubuntu-console ethtool + + # Keep cloud-init, as it performs some of the installation on first boot. + - curtin in-target -- apt-get install -y cloud-init + + # Finally, remove things only installed as dependencies of other things + # we have already removed. + - curtin in-target -- apt-get autoremove -y + + # A postinstall script may optionally be used for further install + # customization. Deploy this postinstall.sh script on the webserver. + # - wget -O /target/postinstall.sh http://192.168.0.2/postinstall.sh + # - curtin in-target -- bash /postinstall.sh + # - rm /target/postinstall.sh + + # Additional cloud-init configuration affecting the target + # system can be supplied underneath a user-data section inside of + # autoinstall. + # user-data: + # … + +# Fichier autoinstall.yml pour autoinstallation Ubuntu 24.04 + +# autoinstall: +# version: 1 +# interactive-sections: +# - network +# - proxy +# - identity + +# # En français +# locale: "fr_FR.UTF-8" +# timezone: "Europe/Paris" + +# refresh-installer: +# update: true + +# keyboard: +# layout: "fr" +# variant: "latin" + +# storage: +# layout: +# name: lvm +# sizing-policy: all + +# ssh: +# install-server: true + +# # install codecs, which currently means installing the +# # ubuntu-restricted-addons package +# codecs: +# install: true + +# # install drivers as suggested by `ubuntu-drivers`. +# drivers: +# install: true + +# # default behaviour +# oem: +# install: auto + +# packages: +# - python3-poetry +# - git + +# # Updates from both the security and updates pockets are installed. +# updates: all + +# # Reboot après l'installation +# shutdown: reboot + +# # Commandes passées dans le système installé +# late-commands: +# - curtin in-target -- git clone https://git.libretic.fr/libretic/libreticmenu.git /opt/ +# - curtin in-target -- /opt/libreticmenu/libreticmenu.sh --firstboot diff --git a/autoinstall.yml b/autoinstall.yml deleted file mode 100644 index f714ae0..0000000 --- a/autoinstall.yml +++ /dev/null @@ -1,55 +0,0 @@ -# Fichier autoinstall.yml pour autoinstallation Ubuntu 24.04 - -autoinstall: - version: 1 - interactive-sections: - - network - - proxy - - identity - - # En français - locale: "fr_FR.UTF-8" - timezone: "Europe/Paris" - - refresh-installer: - update: true - - keyboard: - layout: "fr" - variant: "latin" - - storage: - layout: - name: lvm - sizing-policy: all - - ssh: - install-server: true - - # install codecs, which currently means installing the - # ubuntu-restricted-addons package - codecs: - install: true - - # install drivers as suggested by `ubuntu-drivers`. - drivers: - install: true - - # default behaviour - oem: - install: auto - - packages: - - python3-poetry - - git - - # Updates from both the security and updates pockets are installed. - updates: all - - # Reboot après l'installation - shutdown: reboot - - # Commandes passées dans le système installé - late-commands: - - curtin in-target -- git clone https://git.libretic.fr/libretic/libreticmenu.git /opt/ - - curtin in-target -- /opt/libreticmenu/libreticmenu.sh --cubic diff --git a/config.yml b/config.yml index 62bb48b..e0ebd47 100644 --- a/config.yml +++ b/config.yml @@ -1,9 +1,9 @@ base_path: ansible ansiblemenu: - cubic: - menu_title: Exécuter la configuration dans cubic - argument_help: Ne présente pas le menu et prépare une image cubic - playbook: cubic.yml + firstboot: + menu_title: Exécuter la préparation au premier démarrage + argument_help: Ne présente pas le menu et prépare le système au premier démarrage + playbook: firstboot.yml menu_hidden: true update: