diff --git a/doc/README.md b/doc/README.md index 91513c4c8..0e6e653fc 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,19 +1,14 @@ # Documentation -This `doc` folder is the future location of documentation for Subiquity. This -will be used to migrate the official documentation to readthedocs, and later -will be the home of that documentation. +This `doc` folder is the location of documentation for Subiquity. -The `../documentation` folder is the existing location for this sort of -documentation. As the RTD version is not yet ready, documentation changes -should be made to `../documentation` until this README is updated to say -otherwise. As such, please make any desired documentation changes to -`../documentation`. +In the not distant past, there was also a `../documentation` folder, but that +is now an obsolete copy of what was on Discourse. # Local preview To build this documentation, you can run `make install` from this folder to -create the virtual environment. +create the virtual environment. Then run the `make run` command, which will build a html version of the docs, and serve the docs in the virtual environment. This is very convenient if you diff --git a/documentation/.gitignore b/documentation/.gitignore deleted file mode 100644 index 2aa8485c0..000000000 --- a/documentation/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/discourse/ -/html/ diff --git a/documentation/Makefile b/documentation/Makefile deleted file mode 100644 index dd11234a0..000000000 --- a/documentation/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -SRC = $(wildcard *.md) - -DISCOURSE_MD = $(addprefix discourse/, $(SRC)) -HTML_MD = $(addprefix html/, $(SRC)) -HTML = $(HTML_MD:.md=.html) - -discourse/%.md: %.md - @mkdir --parents discourse - python3 ./substitute-links.py md-to-discourse --input $^ --output $@ - -html/%.md: %.md - @mkdir --parents html - python3 ./substitute-links.py md-to-html --input $^ --output $@ - -%.html: %.md - pandoc $^ --standalone --output $@ - -.PHONY: html -html: $(HTML) - -.PHONY: discourse -discourse: $(DISCOURSE_MD) - -.PHONY: clean -clean: - $(RM) $(DISCOURSE_MD) - $(RM) -d discourse - $(RM) $(HTML) - $(RM) -d html - -.PHONY: new -new: clean all - -.PHONY: all -all: discourse html diff --git a/documentation/autoinstall-quickstart-s390x.md b/documentation/autoinstall-quickstart-s390x.md deleted file mode 100644 index ab44881f6..000000000 --- a/documentation/autoinstall-quickstart-s390x.md +++ /dev/null @@ -1,110 +0,0 @@ - -The intent of this page is to provide simple instructions to perform an autoinstall in a VM on your machine on s390x. - -This page is just a slightly adapted page of [the autoinstall quickstart page](autoinstall-quickstart.md) mapped to s390x. - -## Download an ISO - -At the time of writing (just after the kinetic release), the best place to go is here: - - -```bash -wget https://cdimage.ubuntu.com/ubuntu/releases/22.10/release/ubuntu-22.10-live-server-s390x.iso -P ~/Downloads -``` - -## Mount the ISO - -```bash -mkdir -p ~/iso -sudo mount -r ~/Downloads/ubuntu-22.10-live-server-s390x.iso ~/iso -``` - -## Write your autoinstall config - -This means creating a cloud-init #cloud-config file as follows: - -```bash -mkdir -p ~/www -cd ~/www -cat > user-data << 'EOF' -#cloud-config -autoinstall: - version: 1 - identity: - hostname: ubuntu-server - password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0" - username: ubuntu -EOF -touch meta-data -``` - -The crypted password is just "ubuntu". - -## Serve the cloud-init config over HTTP - -Leave this running in a new terminal window: - -```bash -cd ~/www -python3 -m http.server 3003 -``` - -## Create a target disk - -Proceed with a second terminal window: - -```bash -sudo apt install qemu-utils -``` - -```bash -qemu-img create -f qcow2 disk-image.qcow2 10G -Formatting 'disk-image.qcow2', fmt=qcow2 size=10737418240 cluster_size=65536 lazy_refcounts=off refcount_bits=16 - -qemu-img info disk-image.qcow2 -image: disk-image.qcow2 -file format: qcow2 -virtual size: 10 GiB (10737418240 bytes) -disk size: 196 KiB -cluster_size: 65536 -Format specific information: - compat: 1.1 - lazy refcounts: false - refcount bits: 16 - corrupt: false -``` - -## Run the install! - -```bash -sudo apt install qemu-kvm -``` - -You may need to add the default user to the `kvm` group: - -```bash -sudo usermod -a -G kvm ubuntu -``` - -> **Note**: -> You will need to re-login to make the changes take effect. - -```bash -kvm -no-reboot -name auto-inst-test -nographic -m 2048 \ - -drive file=disk-image.qcow2,format=qcow2,cache=none,if=virtio \ - -cdrom ~/Downloads/ubuntu-22.10-live-server-s390x.iso \ - -kernel ~/iso/boot/kernel.ubuntu \ - -initrd ~/iso/boot/initrd.ubuntu \ - -append 'autoinstall ds=nocloud-net;s=http://_gateway:3003/ console=ttysclp0' -``` - -This will boot, download the config from the server set up in the previous step and run the install. The installer reboots at the end but the `-no-reboot` flag to `kvm` means that `kvm` will exit when this happens. It should take about 5 minutes. - -## Boot the installed system - -```bash -kvm -no-reboot -name auto-inst-test -nographic -m 2048 \ - -drive file=disk-image.qcow2,format=qcow2,cache=none,if=virtio -``` - -This will boot into the freshly installed system and you should be able to log in as `ubuntu`/`ubuntu`. diff --git a/documentation/autoinstall-quickstart.md b/documentation/autoinstall-quickstart.md deleted file mode 100644 index 75fe89a35..000000000 --- a/documentation/autoinstall-quickstart.md +++ /dev/null @@ -1,140 +0,0 @@ -The intent of this page is to provide simple instructions to perform an autoinstall in a VM on your machine. - -This page assumes that you are willing to install the latest Ubuntu release available (23.10 at the time of writing). For other releases, you would need to substitute the name of the ISO image but the instructions should otherwise remain the same. - -This page also assumes you are on the amd64 architecture. There is a [version for s390x](/t/automated-server-install-schema/16616) too. - -## Providing the autoinstall data over the network - -This method is the one that generalises most easily to doing an entirely network-based install, where a machine netboots and is then automatically installed. - -### Download the ISO - -Go to the [23.10 ISO download page](https://releases.ubuntu.com/23.10/) and download the latest Ubuntu 23.10 live-server ISO. - -### Mount the ISO - -```bash -sudo mount -r ~/Downloads/ubuntu-23.10-live-server-amd64.iso /mnt -``` - -### Write your autoinstall config - -This means creating cloud-init config as follows: - -```bash -mkdir -p ~/www -cd ~/www -cat > user-data << 'EOF' -#cloud-config -autoinstall: - version: 1 - identity: - hostname: ubuntu-server - password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0" - username: ubuntu -EOF -touch meta-data -``` -The crypted password is just "ubuntu". - -### Serve the cloud-init config over HTTP - -Leave this running in a new terminal window: - -```bash -cd ~/www -python3 -m http.server 3003 -``` - -### Create a target disk - -```bash -truncate -s 10G image.img -``` - -### Run the install! - -```bash -kvm -no-reboot -m 2048 \ - -drive file=image.img,format=raw,cache=none,if=virtio \ - -cdrom ~/Downloads/ubuntu-22.10-live-server-amd64.iso \ - -kernel /mnt/casper/vmlinuz \ - -initrd /mnt/casper/initrd \ - -append 'autoinstall ds=nocloud-net;s=http://_gateway:3003/' -``` - -This will boot, download the config from the server set up in the previous step, and run the install. The installer reboots at the end but the `-no-reboot` flag to `kvm` means that `kvm` will exit when this happens. It should take about 5 minutes. - -### Boot the installed system - -```bash -kvm -no-reboot -m 2048 \ - -drive file=image.img,format=raw,cache=none,if=virtio -``` - -This will boot into the freshly installed system and you should be able to log in as `ubuntu`/`ubuntu`. - -## Using another volume to provide the autoinstall config - -This is the method to use when you want to create media that you can just plug into a system to have it be installed. - -### Download the live-server ISO - -Go to the [23.10 ISO download page](https://releases.ubuntu.com/23.10/) and download the latest Ubuntu 23.10 live-server ISO. - -### Create your `user-data` and `meta-data` files - -```bash -mkdir -p ~/cidata -cd ~/cidata -cat > user-data << 'EOF' -#cloud-config -autoinstall: - version: 1 - identity: - hostname: ubuntu-server - password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0" - username: ubuntu -EOF -touch meta-data -``` - -The crypted password is just "ubuntu". - -### Create an ISO to use as a cloud-init data source - -```bash -sudo apt install cloud-image-utils -cloud-localds ~/seed.iso user-data meta-data -``` - -### Create a target disk - -```bash -truncate -s 10G image.img -``` - -### Run the install! - -```bash -kvm -no-reboot -m 2048 \ - -drive file=image.img,format=raw,cache=none,if=virtio \ - -drive file=~/seed.iso,format=raw,cache=none,if=virtio \ - -cdrom ~/Downloads/ubuntu-22.10-live-server-amd64.iso -``` - -This will boot and run the install. Unless you interrupt boot to add `autoinstall` to the kernel command line, the installer will prompt for confirmation before touching the disk. - -The installer reboots at the end but the `-no-reboot` flag to `kvm` means that `kvm` will exit when this happens. - -The whole process should take about 5 minutes. - -### Boot the installed system - -```bash -kvm -no-reboot -m 2048 \ - -drive file=image.img,format=raw,cache=none,if=virtio -``` - -This will boot into the freshly installed system and you should be able to log in as `ubuntu`/`ubuntu`. diff --git a/documentation/autoinstall-reference.md b/documentation/autoinstall-reference.md deleted file mode 100644 index 091f5696d..000000000 --- a/documentation/autoinstall-reference.md +++ /dev/null @@ -1,782 +0,0 @@ -## Overall format - -The autoinstall file is YAML. At top level it must be a mapping containing the keys described in this document. Unrecognized keys are ignored. - -## Schema - -Autoinstall configs [are validated against a JSON schema](autoinstall-schema.md) before they are used. - - - -## Command lists - -Several config keys are lists of commands to be executed. Each command can be a string (in which case it is executed via "sh -c") or a list, in which case it is executed directly. Any command exiting with a non-zero return code is considered an error and aborts the install (except for error-commands, where it is ignored). - -## Top-level keys - - - -### version - -**type:** integer -**default:** no default - -A future-proofing config file version field. Currently this must be "1". - - - -### interactive-sections - -**type:** list of strings -**default:** [] - -A list of config keys to still show in the UI. So for example: - -```yaml -version: 1 -interactive-sections: - - network -identity: - username: ubuntu - password: $crypted_pass -``` - -Would stop on the network screen and allow the user to change the defaults. If a value is provided for an interactive section it is used as the default. - -You can use the special section name of "\*" to indicate that the installer should ask all the usual questions -- in this case, the `autoinstall.yaml` file is not really an "autoinstall" file at all, instead just a way to change the defaults in the UI. - -Not all config keys correspond to screens in the UI. This documentation indicates if a given section can be interactive or not. - -If there are any interactive sections at all, the [reporting](#reporting) key is ignored. - - - -### early-commands - -**type:** [command list](#commandlist) -**default:** no commands -**can be interactive:** no - -A list of shell commands to invoke as soon as the installer starts, in particular before probing for block and network devices. The autoinstall config is available at `/autoinstall.yaml` (irrespective of how it was provided) and the file will be re-read after the `early-commands` have run to allow them to alter the config if necessary. - - - -### locale - -**type:** string -**default:** `en_US.UTF-8` -**can be interactive:** yes - -The locale to configure for the installed system. - - - -### refresh-installer - -**type:** mapping -**default:** see below -**can be interactive:** yes - -Controls whether the installer updates to a new version available in the given channel before continuing. - -The mapping contains keys: - -#### update - -**type:** boolean -**default:** `false` - -Whether to update or not. - -#### channel - -**type:** string -**default:** `"stable/ubuntu-$REL"` - -The channel to check for updates. - - - -### keyboard - -**type:** mapping, see below -**default:** US English keyboard -**can be interactive:** yes - -The layout of any attached keyboard. Often systems being automatically installed will not have a keyboard at all in which case the value used here does not matter. - -The mapping's keys correspond to settings in the `/etc/default/keyboard` configuration file. See [its manual page](http://manpages.ubuntu.com/manpages/bionic/en/man5/keyboard.5.html) for more details. - -The mapping contains keys: - -#### layout - -**type:** string -**default:** `"us"` - -Corresponds to the `XKBLAYOUT` setting. - -#### variant - -**type:** string -**default:** `""` - -Corresponds to the `XKBVARIANT` setting. - -#### toggle - -**type:** string or null -**default:** `null` - -Corresponds to the value of `grp:` option from the `XKBOPTIONS` setting. Acceptable values are (but note that the installer does not validate these): `caps_toggle`, `toggle`, `rctrl_toggle`, `rshift_toggle`, `rwin_toggle`, `menu_toggle`, `alt_shift_toggle`, `ctrl_shift_toggle`, `ctrl_alt_toggle`, `alt_caps_toggle`, `lctrl_lshift_toggle`, `lalt_toggle`, `lctrl_toggle`, `lshift_toggle`, `lwin_toggle`, `sclk_toggle` - -The version of Subiquity released with 20.04 GA does not accept `null` for this field due to a bug. - -### source -**type:** mapping, see below -**default:** see below -**can be interactive:** yes - -#### search_drivers -**type:** boolean -**default:** `true` (mostly, see below) - -Whether the installer should search for available third-party -drivers. When set to `false`, it disables the drivers screen and -[section](#drivers). - -The default is true for most installs but false when a "core boot" or -"enhanced secure boot" method is selected (where third-party drivers -cannot currently be installed). - -#### id -**type:** string -**default:** identifier of the first available source. - -Identifier of the source to install (e.g., `"ubuntu-server-minimal"`). - - - -### network - -**type:** netplan-format mapping, see below -**default:** DHCP on interfaces named eth\* or en\* -**can be interactive:** yes - -[Netplan-formatted](https://netplan.readthedocs.io/en/stable/netplan-yaml/) network configuration. This will be applied during installation as well as in the installed system. The default is to interpret the config for the install media, which runs DHCPv4 on any interface with a name matching "eth\*" or "en\*" but then disables any interface that does not receive an address. - -For example, to run DHCPv6 on a particular NIC: - -```yaml -network: - version: 2 - ethernets: - enp0s31f6: - dhcp6: true -``` - -Note that because of a bug, the version of Subiquity released with 20.04 GA forces you to write this with an extra `network:` key like so: - -```yaml -network: - network: - version: 2 - ethernets: - enp0s31f6: - dhcp6: true -``` - -Later versions support this syntax too for compatibility but if you can assume a newer version you should use the former. - - - -### proxy - -**type:** URL or `null` -**default:** no proxy -**can be interactive:** yes - -The proxy to configure both during installation and for `apt` and for `snapd` in the target system. - - - -### apt - -**type:** mapping -**default:** see below -**can be interactive:** yes - -Apt configuration, used both during the install and once booted into the target system. - -This section historically used the same format as curtin, [which is documented here](https://curtin.readthedocs.io/en/latest/topics/apt_source.html). Nonetheless, some key differences with the format supported by curtin have been introduced: - - * Subiquity supports an alternative format for the `primary` section, allowing to configure a list of candidate primary mirrors. During installation, subiquity will automatically test the specified mirrors and select the first one that seems usable. This new behavior is only activated when the `primary` section is wrapped in the `mirror-selection` section. - * The `fallback` key controls what subiquity should do if no primary mirror is usable. - * The `geoip` key controls whether a geoip lookup is done to determine the correct country mirror. - -The default is: - -```yaml -apt: - preserve_sources_list: false - mirror-selection: - primary: - - country-mirror - - arches: [i386, amd64] - uri: "http://archive.ubuntu.com/ubuntu" - - arches: [s390x, arm64, armhf, powerpc, ppc64el, riscv64] - uri: "http://ports.ubuntu.com/ubuntu-ports" - fallback: abort - geoip: true -``` - -#### mirror-selection -if the `primary` section is contained within the `mirror-selection` section, the automatic mirror selection is enabled. This is the default in new installations. - -#### primary (when placed inside the `mirror-selection` section): -**type:** custom, see below - -In the new format, the `primary` section expects a list of mirrors, which can be expressed in two different ways: - - * the special value `country-mirror` - * a mapping with the following keys: - * `uri`: the URI of the mirror to use, e.g., "http://fr.archive.ubuntu.com/ubuntu" - * `arches`: an optional list of architectures supported by the mirror. By default, this list contains the current CPU architecture. - -#### fallback -**type:** string (enumeration) -**default:** abort - -Controls what subiquity should do if no primary mirror is usable. -Supported values are: - - * `abort` -> abort the installation - * `offline-install` -> revert to an offline installation - * `continue-anyway` -> attempt to install the system anyway (not recommended, the installation will certainly fail) - -#### geoip -**type:** boolean -**default:**: `true` - -If geoip is true and one of the candidate primary mirrors has the special value `country-mirror`, a request is made to `https://geoip.ubuntu.com/lookup`. Subiquity then sets the mirror URI to `http://CC.archive.ubuntu.com/ubuntu` (or similar for ports) where `CC` is the country code returned by the lookup. If this section is not interactive, the request is timed out after 10 seconds. - -If the legacy behavior (i.e., without mirror-selection) is in use, the geoip request is made if the mirror to be used is the default, and its URI ends up getting replaced by the proper country mirror URI. - -If you just want to specify a mirror, you can use a configuration like this: - -```yaml -apt: - mirror-selection: - primary: - - uri: YOUR_MIRROR_GOES_HERE - - country-mirror - - uri: http://archive.ubuntu.com/ubuntu -``` - -To add a ppa: - -```yaml -apt: - sources: - curtin-ppa: - source: ppa:curtin-dev/test-archive -``` - - - -### storage - -**type:** mapping, see below -**default:** use "lvm" layout in a single disk system, no default in a multiple disk system -**can be interactive:** yes - -Storage configuration is a complex topic and the description of the desired configuration in the autoinstall file can also be complex. The installer supports "layouts", simple ways of expressing common configurations. - -#### Supported layouts - -The three supported layouts at the time of writing are "lvm", "direct", and "zfs". -```yaml -storage: - layout: - name: lvm -storage: - layout: - name: direct -storage: - layout: - name: zfs -``` - -By default these will install to the largest disk in a system, but you can supply a match spec (see below) to indicate which disk to use: - -```yaml -storage: - layout: - name: lvm - match: - serial: CT* -storage: - layout: - name: direct - match: - ssd: true -``` - -(you can just say "`match: {}`" to match an arbitrary disk) - -When using the "lvm" layout, LUKS encryption can be enabled by supplying a password. - -```yaml -storage: - layout: - name: lvm - password: LUKS_PASSPHRASE -``` - -The default is to use the `lvm` layout. - -#### sizing-policy - -The lvm layout will, by default, attempt to leave room for snapshots and further expansion. A sizing-policy key may be supplied to control this behavior. - -**type:** string (enumeration) -**default:** scaled - -Supported values are: - - * `scaled` -> adjust space allocated to the root LV based on space available to the VG - * `all` -> allocate all remaining VG space to the root LV - -The scaling system is currently as follows: - * Less than 10 GiB: use all remaining space for root filesystem - * Between 10-20 GiB: 10 GiB root filesystem - * Between 20-200 GiB: use half of remaining space for root filesystem - * Greater than 200 GiB: 100 GiB root filesystem - -Example with no size scaling and a passphrase: -```yaml -storage: - layout: - name: lvm - sizing-policy: all - password: LUKS_PASSPHRASE -``` - -#### Action-based config - -For full flexibility, the installer allows storage configuration to be done using a syntax which is a superset of that supported by curtin, described at https://curtin.readthedocs.io/en/latest/topics/storage.html. - -If the "layout" feature is used to configure the disks, the "config" section will not be used. - -As well as putting the list of actions under the 'config' key, the [grub](https://curtin.readthedocs.io/en/latest/topics/config.html#grub) and [swap](https://curtin.readthedocs.io/en/latest/topics/config.html#swap) curtin config items can be put here. So a storage section might look like: - -```yaml -storage: - swap: - size: 0 - config: - - type: disk - id: disk0 - serial: ADATA_SX8200PNP_XXXXXXXXXXX - - type: partition - ... -``` - -The extensions to the curtin syntax are around disk selection and partition/logical volume sizing. - -##### Disk selection extensions - -Curtin supported identifying disks by serial (e.g. `Crucial_CT512MX100SSD1_14250C57FECE`) or by path (e.g. `/dev/sdc`) and the server installer supports this as well. The installer additionally supports a ''match spec'' on a disk action that supports more flexible matching. - -The actions in the storage config are processed in the order they are in the autoinstall file. Any disk action is assigned a matching disk -- chosen arbitrarily from the set of unassigned disks if there is more than one, and causing the installation to fail if there is no unassigned matching disk. - -A match spec supports the following keys: - - * `model: foo`: matches a disk where ID_VENDOR=foo in udev, supporting globbing - * `path: foo`: matches a disk based on path (e.g. `/dev/sdc`), supporting globbing (the globbing support distinguishes this from specifying path: foo directly in the disk action) - * `id_path: foo`: matches a disk where ID_PATH=foo in udev, supporting globbing - * `devpath: foo`: matches a disk where DEVPATH=foo in udev, supporting globbing - * `serial: foo`: matches a disk where ID_SERIAL=foo in udev, supporting globbing (the globbing support distinguishes this from specifying serial: foo directly in the disk action) - * `ssd: true|false`: matches a disk that is or is not an SSD (vs a rotating drive) - * `size: largest|smallest`: take the largest or smallest disk rather than an arbitrary one if there are multiple matches (support for `smallest` added in version 20.06.1) - -A special sort of key is `install-media: true`, which will take the disk the installer was loaded from (the `ssd` and `size` selectors will never return this disk). If installing to the install media, care obviously needs to be take to not overwrite the installer itself! - -So for example, to match an arbitrary disk it is simply: - -```yaml - - type: disk - id: disk0 -``` - -To match the largest SSD: - -```yaml - - type: disk - id: big-fast-disk - match: - ssd: true - size: largest -``` - -To match a Seagate drive: - -```yaml - - type: disk - id: data-disk - match: - model: Seagate -``` - -##### Partition/logical volume extensions - -The size of a partition or logical volume in curtin is specified as a number of bytes. The autoinstall config is more flexible: - - * You can specify the size using the "1G", "512M" syntax supported in the installer UI. - * You can specify the size as a percentage of the containing disk (or RAID), e.g. "50%". - * For the last partition specified for a particular device, you can specify the size as "-1" to indicate that the partition should fill the remaining space. - -```yaml - - type: partition - id: boot-partition - device: root-disk - size: 10% - - type: partition - id: root-partition - size: 20G - - type: partition - id: data-partition - device: root-disk - size: -1 -``` - - - -### identity - -**type:** mapping, see below -**default:** no default -**can be interactive:** yes - -Configure the initial user for the system. This is the only config key that must be present (unless the [user-data section](#user-data) is present, in which case it is optional). - -A mapping that can contain keys, all of which take string values: - -#### realname - -The real name for the user. This field is optional. - -#### username - -The user name to create. - -#### hostname - -The hostname for the system. - -#### password - -The password for the new user, encrypted. This is required for use with `sudo`, even if SSH access is configured. - -The crypted password string must conform to what [passwd](https://manpages.ubuntu.com/manpages/jammy/en/man1/passwd.1.html) expects. Depending on the special characters in the password hash, quoting may be required, so it's safest to just always include the quotes around the hash. - -Several tools can generate the crypted password, such as `mkpasswd` from the `whois` package, or `openssl passwd`. - -Example: - -```yaml -identity: - realname: 'Ubuntu User' - username: ubuntu - password: '$6$wdAcoXrU039hKYPd$508Qvbe7ObUnxoj15DRCkzC3qO7edjH0VV7BPNRDYK4QR8ofJaEEF2heacn0QgD.f8pO8SNp83XNdWG6tocBM1' - hostname: ubuntu -``` - -### active-directory - -**type:** mapping, see below -**default:** no default -**can be interactive:** yes - -Accepts data required to join the target system in an Active Directory domain. - -A mapping that can contain keys, all of which take string values: - -#### admin-name - -A domain account name with privilege to perform the join operation. That account's password will be requested during runtime. - -#### domain-name - -The Active Directory domain to join. - -### ubuntu-pro - -**type:** mapping, see below -**default:** see below -**can be interactive:** yes - -#### token - -**type:** string -**default:** no token - -A contract token to attach to an existing Ubuntu Pro subscription. - - - -### ssh - -**type:** mapping, see below -**default:** see below -**can be interactive:** yes - -Configure SSH for the installed system. A mapping that can contain keys: - -#### install-server - -**type:** boolean -**default:** `false` - -Whether to install OpenSSH server in the target system. - -#### authorized-keys - -**type:** list of strings -**default:** `[]` - -A list of SSH public keys to install in the initial user's account. - -#### allow-pw - -**type:** boolean -**default:** `true` if `authorized_keys` is empty, `false` otherwise - - - -### codecs - -**type:** mapping, see below -**default:** see below -**can be interactive:** no - -Configure whether common restricted packages (including codecs) from [multiverse] should be installed. - -#### install - -**type:** boolean -**default:** `false` - -Whether to install the ubuntu-restricted-addons package. - - - -### drivers - -**type:** mapping, see below -**default:** see below -**can be interactive:** yes - -#### install - -**type:** boolean -**default:** `false` - -Whether to install the available third-party drivers. - - - -### oem - -**type:** mapping, see below -**default:** see below -**can be interactive:** no - -#### install - -**type:** boolean or string (special value `auto`) -**default:**: `auto` - -Whether to install the available OEM meta-packages. The special value `auto` - which is the default - enables the installation on ubuntu-desktop but not on ubuntu-server. -This option has no effect on core boot classic. - - - -### snaps - -**type:** list -**default:** install no extra snaps -**can be interactive:** yes - -A list of snaps to install. Each snap is represented as a mapping with required `name` and optional `channel` (defaulting to `stable`) and classic (defaulting to `false`) keys. For example: - -``` -snaps: - - name: etcd - channel: edge - classic: false -``` - - - -### debconf-selections - -**type:** string -**default:** no config -**can be interactive:** no - -The installer will update the target with debconf set-selection values. Users will need to be familiar with the package debconf options. - - - -### packages - -**type:** list -**default:** no packages -**can be interactive:** no - -A list of packages to install into the target system. More precisely, a list of strings to pass to "`apt-get install`", so this includes things like task selection (`dns-server^`) and installing particular versions of a package (`my-package=1-1`). - -### kernel - -**type:** mapping (mutually exclusive), see below -**default:** default kernel -**can be interactive:** no - -Which kernel gets installed. Either the name of the package or the name of the flavor must be specified. - -#### package - -**type:** string - -The name of the package, e.g., `linux-image-5.13.0-40-generic` - -#### flavor - -**type:** string - -The flavor of the kernel, e.g., `generic` or `hwe`. - -### timezone - -**type:** string -**default:** no timezone -**can be interactive:** no - -The timezone to configure on the system. The special value "geoip" can be used to query the timezone automatically over the network. - -### updates - -**type:** string (enumeration) -**default:** `security` -**can be interactive:** no - -The type of updates that will be downloaded and installed after the system install. -Supported values are: - - * `security` -> download and install updates from the -security pocket - * `all` -> also download and install updates from the -updates pocket - -### shutdown - -**type:** string (enumeration) -**default:** `reboot` -**can be interactive:** no - -Request the system to power off or reboot automatically after the installation has finished. -Supported values are: - - * `reboot` - * `poweroff` - - - -### late-commands - -**type:** [command list](#commandlist) -**default:** no commands -**can be interactive:** no - -Shell commands to run after the install has completed successfully and any updates and packages installed, just before the system reboots. They are run in the installer environment with the installed system mounted at `/target`. You can run `curtin in-target -- $shell_command` (with the version of subiquity released with 20.04 GA you need to specify this as `curtin in-target --target=/target -- $shell_command`) to run in the target system (similar to how plain `in-target` can be used in `d-i preseed/late_command`). - - - -### error-commands - -**type:** [command list](#commandlist) -**default:** no commands -**can be interactive:** no - -Shell commands to run after the install has failed. They are run in the installer environment, and the target system (or as much of it as the installer managed to configure) will be mounted at /target. Logs will be available at `/var/log/installer` in the live session. - - - -### reporting - -**type:** mapping -**default:** `type: print` which causes output on tty1 and any configured serial consoles -**can be interactive:** no - -The installer supports reporting progress to a variety of destinations. Note that this section is ignored if there are any [interactive sections](#interactive-sections); it only applies to fully automated installs. - -The config, and indeed the implementation, is 90% the same as [that used by curtin](https://curtin.readthedocs.io/en/latest/topics/reporting.html). - -Each key in the `reporting` mapping in the config defines a destination, where the `type` sub-key is one of: - -**The rsyslog reporter does not yet exist** - - * **print**: print progress information on tty1 and any configured serial console. There is no other configuration. - * **rsyslog**: report progress via rsyslog. The **destination** key specifies where to send output. - * **webhook**: report progress via POSTing JSON reports to a URL. Accepts the same configuration as [curtin](https://curtin.readthedocs.io/en/latest/topics/reporting.html#webhook-reporter). - * **none**: do not report progress. Only useful to inhibit the default output. - -Examples: - -The default configuration is: - -```yaml -reporting: - builtin: - type: print -``` - -Report to rsyslog: - -```yaml -reporting: - central: - type: rsyslog - destination: @192.168.0.1 -``` - -Suppress the default output: - -```yaml -reporting: - builtin: - type: none -``` - -Report to a curtin-style webhook: - -```yaml -reporting: - hook: - type: webhook - endpoint: http://example.com/endpoint/path - consumer_key: "ck_foo" - consumer_secret: "cs_foo" - token_key: "tk_foo" - token_secret: "tk_secret" - level: INFO -``` - - - -### user-data - -**type:** mapping -**default:** `{}` -**can be interactive:** no - -Provide cloud-init user data which will be merged with the user data the installer produces. If you supply this, you don't need to supply an [identity section](#identity) (but then it's your responsibility to make sure that you can log into the installed system!). diff --git a/documentation/autoinstall-schema.md b/documentation/autoinstall-schema.md deleted file mode 100644 index 5645f7d75..000000000 --- a/documentation/autoinstall-schema.md +++ /dev/null @@ -1,570 +0,0 @@ -## Introduction - -The server installer validates the provided autoinstall config against a [JSON schema](#Schema). - -## How the config is validated - -Although the schema is presented below as a single document, and if you want to pre-validate your config you should validate it against this document, the config is not actually validated against this document at run time. What happens instead is that some sections are loaded, validated, and applied first, before all other sections are validated. In detail: - - 1. The reporting section is loaded, validated and applied. - 2. The error commands are loaded and validated. - 3. The early commands are loaded and validated. - 4. The early commands, if any, are run. - 5. The config is reloaded, and now all sections are loaded and validated. - -This is so that validation errors in most sections can be reported via the reporting and error-commands configuration, as all other errors are. - -## Schema - -The [JSON schema](https://json-schema.org/) for autoinstall data is as follows: - -
{
-    "type": "object",
-    "properties": {
-        "version": {
-            "type": "integer",
-            "minimum": 1,
-            "maximum": 1
-        },
-        "early-commands": {
-            "type": "array",
-            "items": {
-                "type": [
-                    "string",
-                    "array"
-                ],
-                "items": {
-                    "type": "string"
-                }
-            }
-        },
-        "reporting": {
-            "type": "object",
-            "additionalProperties": {
-                "type": "object",
-                "properties": {
-                    "type": {
-                        "type": "string"
-                    }
-                },
-                "required": [
-                    "type"
-                ],
-                "additionalProperties": true
-            }
-        },
-        "error-commands": {
-            "type": "array",
-            "items": {
-                "type": [
-                    "string",
-                    "array"
-                ],
-                "items": {
-                    "type": "string"
-                }
-            }
-        },
-        "user-data": {
-            "type": "object"
-        },
-        "packages": {
-            "type": "array",
-            "items": {
-                "type": "string"
-            }
-        },
-        "debconf-selections": {
-            "type": "string"
-        },
-        "locale": {
-            "type": "string"
-        },
-        "refresh-installer": {
-            "type": "object",
-            "properties": {
-                "update": {
-                    "type": "boolean"
-                },
-                "channel": {
-                    "type": "string"
-                }
-            },
-            "additionalProperties": false
-        },
-        "kernel": {
-            "type": "object",
-            "properties": {
-                "package": {
-                    "type": "string"
-                },
-                "flavor": {
-                    "type": "string"
-                }
-            },
-            "oneOf": [
-                {
-                    "type": "object",
-                    "required": [
-                        "package"
-                    ]
-                },
-                {
-                    "type": "object",
-                    "required": [
-                        "flavor"
-                    ]
-                }
-            ]
-        },
-        "keyboard": {
-            "type": "object",
-            "properties": {
-                "layout": {
-                    "type": "string"
-                },
-                "variant": {
-                    "type": "string"
-                },
-                "toggle": {
-                    "type": [
-                        "string",
-                        "null"
-                    ]
-                }
-            },
-            "required": [
-                "layout"
-            ],
-            "additionalProperties": false
-        },
-        "source": {
-            "type": "object",
-            "properties": {
-                "search_drivers": {
-                    "type": "boolean"
-                },
-                "id": {
-                    "type": "string"
-                }
-            }
-        },
-        "network": {
-            "oneOf": [
-                {
-                    "type": "object",
-                    "properties": {
-                        "version": {
-                            "type": "integer",
-                            "minimum": 2,
-                            "maximum": 2
-                        },
-                        "ethernets": {
-                            "type": "object",
-                            "properties": {
-                                "match": {
-                                    "type": "object",
-                                    "properties": {
-                                        "name": {
-                                            "type": "string"
-                                        },
-                                        "macaddress": {
-                                            "type": "string"
-                                        },
-                                        "driver": {
-                                            "type": "string"
-                                        }
-                                    },
-                                    "additionalProperties": false
-                                }
-                            }
-                        },
-                        "wifis": {
-                            "type": "object",
-                            "properties": {
-                                "match": {
-                                    "type": "object",
-                                    "properties": {
-                                        "name": {
-                                            "type": "string"
-                                        },
-                                        "macaddress": {
-                                            "type": "string"
-                                        },
-                                        "driver": {
-                                            "type": "string"
-                                        }
-                                    },
-                                    "additionalProperties": false
-                                }
-                            }
-                        },
-                        "bridges": {
-                            "type": "object"
-                        },
-                        "bonds": {
-                            "type": "object"
-                        },
-                        "tunnels": {
-                            "type": "object"
-                        },
-                        "vlans": {
-                            "type": "object"
-                        }
-                    },
-                    "required": [
-                        "version"
-                    ]
-                },
-                {
-                    "type": "object",
-                    "properties": {
-                        "network": {
-                            "type": "object",
-                            "properties": {
-                                "version": {
-                                    "type": "integer",
-                                    "minimum": 2,
-                                    "maximum": 2
-                                },
-                                "ethernets": {
-                                    "type": "object",
-                                    "properties": {
-                                        "match": {
-                                            "type": "object",
-                                            "properties": {
-                                                "name": {
-                                                    "type": "string"
-                                                },
-                                                "macaddress": {
-                                                    "type": "string"
-                                                },
-                                                "driver": {
-                                                    "type": "string"
-                                                }
-                                            },
-                                            "additionalProperties": false
-                                        }
-                                    }
-                                },
-                                "wifis": {
-                                    "type": "object",
-                                    "properties": {
-                                        "match": {
-                                            "type": "object",
-                                            "properties": {
-                                                "name": {
-                                                    "type": "string"
-                                                },
-                                                "macaddress": {
-                                                    "type": "string"
-                                                },
-                                                "driver": {
-                                                    "type": "string"
-                                                }
-                                            },
-                                            "additionalProperties": false
-                                        }
-                                    }
-                                },
-                                "bridges": {
-                                    "type": "object"
-                                },
-                                "bonds": {
-                                    "type": "object"
-                                },
-                                "tunnels": {
-                                    "type": "object"
-                                },
-                                "vlans": {
-                                    "type": "object"
-                                }
-                            },
-                            "required": [
-                                "version"
-                            ]
-                        }
-                    },
-                    "required": [
-                        "network"
-                    ]
-                }
-            ]
-        },
-        "ubuntu-pro": {
-            "type": "object",
-            "properties": {
-                "token": {
-                    "type": "string",
-                    "minLength": 24,
-                    "maxLength": 30,
-                    "pattern": "^C[1-9A-HJ-NP-Za-km-z]+$",
-                    "description": "A valid token starts with a C and is followed by 23 to 29 Base58 characters.\nSee https://pkg.go.dev/github.com/btcsuite/btcutil/base58#CheckEncode"
-                }
-            }
-        },
-        "ubuntu-advantage": {
-            "type": "object",
-            "properties": {
-                "token": {
-                    "type": "string",
-                    "minLength": 24,
-                    "maxLength": 30,
-                    "pattern": "^C[1-9A-HJ-NP-Za-km-z]+$",
-                    "description": "A valid token starts with a C and is followed by 23 to 29 Base58 characters.\nSee https://pkg.go.dev/github.com/btcsuite/btcutil/base58#CheckEncode"
-                }
-            },
-            "deprecated": true,
-            "description": "Compatibility only - use ubuntu-pro instead"
-        },
-        "proxy": {
-            "type": [
-                "string",
-                "null"
-            ],
-            "format": "uri"
-        },
-        "apt": {
-            "type": "object",
-            "properties": {
-                "preserve_sources_list": {
-                    "type": "boolean"
-                },
-                "primary": {
-                    "type": "array"
-                },
-                "mirror-selection": {
-                    "type": "object",
-                    "properties": {
-                        "primary": {
-                            "type": "array",
-                            "items": {
-                                "anyOf": [
-                                    {
-                                        "type": "string",
-                                        "const": "country-mirror"
-                                    },
-                                    {
-                                        "type": "object",
-                                        "properties": {
-                                            "uri": {
-                                                "type": "string"
-                                            },
-                                            "arches": {
-                                                "type": "array",
-                                                "items": {
-                                                    "type": "string"
-                                                }
-                                            }
-                                        },
-                                        "required": [
-                                            "uri"
-                                        ]
-                                    }
-                                ]
-                            }
-                        }
-                    }
-                },
-                "geoip": {
-                    "type": "boolean"
-                },
-                "sources": {
-                    "type": "object"
-                },
-                "disable_components": {
-                    "type": "array",
-                    "items": {
-                        "type": "string",
-                        "enum": [
-                            "universe",
-                            "multiverse",
-                            "restricted",
-                            "contrib",
-                            "non-free"
-                        ]
-                    }
-                },
-                "preferences": {
-                    "type": "array",
-                    "items": {
-                        "type": "object",
-                        "properties": {
-                            "package": {
-                                "type": "string"
-                            },
-                            "pin": {
-                                "type": "string"
-                            },
-                            "pin-priority": {
-                                "type": "integer"
-                            }
-                        },
-                        "required": [
-                            "package",
-                            "pin",
-                            "pin-priority"
-                        ]
-                    }
-                },
-                "fallback": {
-                    "type": "string",
-                    "enum": [
-                        "abort",
-                        "continue-anyway",
-                        "offline-install"
-                    ]
-                }
-            }
-        },
-        "storage": {
-            "type": "object"
-        },
-        "identity": {
-            "type": "object",
-            "properties": {
-                "realname": {
-                    "type": "string"
-                },
-                "username": {
-                    "type": "string"
-                },
-                "hostname": {
-                    "type": "string"
-                },
-                "password": {
-                    "type": "string"
-                }
-            },
-            "required": [
-                "username",
-                "hostname",
-                "password"
-            ],
-            "additionalProperties": false
-        },
-        "ssh": {
-            "type": "object",
-            "properties": {
-                "install-server": {
-                    "type": "boolean"
-                },
-                "authorized-keys": {
-                    "type": "array",
-                    "items": {
-                        "type": "string"
-                    }
-                },
-                "allow-pw": {
-                    "type": "boolean"
-                }
-            }
-        },
-        "snaps": {
-            "type": "array",
-            "items": {
-                "type": "object",
-                "properties": {
-                    "name": {
-                        "type": "string"
-                    },
-                    "channel": {
-                        "type": "string"
-                    },
-                    "classic": {
-                        "type": "boolean"
-                    }
-                },
-                "required": [
-                    "name"
-                ],
-                "additionalProperties": false
-            }
-        },
-        "active-directory": {
-            "type": "object",
-            "properties": {
-                "admin-name": {
-                    "type": "string"
-                },
-                "domain-name": {
-                    "type": "string"
-                }
-            },
-            "additionalProperties": false
-        },
-        "codecs": {
-            "type": "object",
-            "properties": {
-                "install": {
-                    "type": "boolean"
-                }
-            }
-        },
-        "drivers": {
-            "type": "object",
-            "properties": {
-                "install": {
-                    "type": "boolean"
-                }
-            }
-        },
-        "oem": {
-            "type": "object",
-            "properties": {
-                "install": {
-                    "oneOf": [
-                        {
-                            "type": "boolean"
-                        },
-                        {
-                            "type": "string",
-                            "const": "auto"
-                        }
-                    ]
-                }
-            },
-            "required": [
-                "install"
-            ]
-        },
-        "timezone": {
-            "type": "string"
-        },
-        "updates": {
-            "type": "string",
-            "enum": [
-                "security",
-                "all"
-            ]
-        },
-        "late-commands": {
-            "type": "array",
-            "items": {
-                "type": [
-                    "string",
-                    "array"
-                ],
-                "items": {
-                    "type": "string"
-                }
-            }
-        },
-        "shutdown": {
-            "type": "string",
-            "enum": [
-                "reboot",
-                "poweroff"
-            ]
-        }
-    },
-    "required": [
-        "version"
-    ],
-    "additionalProperties": true
-}
-
- -## Regeneration - -The schema above can be regenerated by running "make schema" in a Subiquity source checkout. diff --git a/documentation/autoinstall.md b/documentation/autoinstall.md deleted file mode 100644 index 3cb1442ec..000000000 --- a/documentation/autoinstall.md +++ /dev/null @@ -1,156 +0,0 @@ -## Introduction - -Since version 20.04, the server installer supports automated installation mode (autoinstallation for short). You might also know this feature as *unattended*, *hands-off*, or *preseeded* installation. - -Autoinstallation lets you answer all those configuration questions ahead of time with an *autoinstall config*, and lets the installation process run without any interaction. - -## Differences from debian-installer preseeding - -*Preseeds* are the way to automate an installer based on debian-installer (a.k.a. *d-i*). - -Autoinstalls for the new server installer differ from preseeds in the following main ways: - - * The format is completely different (cloud-init config, usually YAML, vs. `debconf-set-selections` format). - * When the answer to a question is not present in a preseed, d-i stops and asks the user for input. Autoinstalls are not like this: by default, if there is any autoinstall config at all, the installer takes the default for any unanswered question (and fails if there is no default). - * You can designate particular sections in the config as "interactive", which means the installer will still stop and ask about those. - -## Provide the autoinstall config via cloud-init - -The autoinstall config is provided via cloud-init configuration, which is almost endlessly flexible. In most scenarios, the easiest way will be to provide user data [via the NoCloud datasource](https://cloudinit.readthedocs.io/en/latest/reference/datasources/nocloud.html). - -The autoinstall config should be provided under the `autoinstall` key in the config. For example: - -```yaml -#cloud-config -autoinstall: - version: 1 - ... -``` - -## Run a truly automatic autoinstall - -Even if a fully non-interactive autoinstall config is found, the server installer will ask for confirmation before writing to the disks unless `autoinstall` is present on the kernel command line. This is to make it harder to accidentally create a USB stick that will reformat the machine it is plugged into at boot. Many autoinstalls will be done via netboot, where the kernel command line is controlled by the netboot config -- just remember to put `autoinstall` in there! - -### Quick start - -So you just want to try it out? Well we have [the page for you](autoinstall-quickstart.md). - -### Create an autoinstall config - -When any system is installed using the server installer, an autoinstall file for repeating the install is created at `/var/log/installer/autoinstall-user-data`. - -### Translate a preseed file - -If you have a preseed file already, the [autoinstall-generator snap](https://snapcraft.io/autoinstall-generator) can help translate that preseed data to an autoinstall file. See this discussion on the [autoinstall generator tool](https://discourse.ubuntu.com/t/autoinstall-generator-tool-to-help-with-creation-of-autoinstall-files-based-on-preseed/21334) for more details on how to set this up. - -## The structure of an autoinstall config - -The autoinstall config has [full documentation](autoinstall-reference.md). - -Technically speaking, the config is not defined as a textual format, but cloud-init config is usually provided as YAML so that is the syntax the documentation uses. A minimal config consists of: - -```yaml -version: 1 -identity: - hostname: hostname - username: username - password: $crypted_pass -``` - -However, here is a more complete example file that shows off most features: - -
version: 1
-reporting:
-    hook:
-        type: webhook
-        endpoint: http://example.com/endpoint/path
-early-commands:
-    - ping -c1 198.162.1.1
-locale: en_US
-keyboard:
-    layout: gb
-    variant: dvorak
-network:
-    network:
-        version: 2
-        ethernets:
-            enp0s25:
-               dhcp4: yes
-            enp3s0: {}
-            enp4s0: {}
-        bonds:
-            bond0:
-                dhcp4: yes
-                interfaces:
-                    - enp3s0
-                    - enp4s0
-                parameters:
-                    mode: active-backup
-                    primary: enp3s0
-proxy: http://squid.internal:3128/
-apt:
-    primary:
-        - arches: [default]
-          uri: http://repo.internal/
-    sources:
-        my-ppa.list:
-            source: "deb http://ppa.launchpad.net/curtin-dev/test-archive/ubuntu $RELEASE main"
-            keyid: B59D 5F15 97A5 04B7 E230  6DCA 0620 BBCF 0368 3F77
-storage:
-    layout:
-        name: lvm
-identity:
-    hostname: hostname
-    username: username
-    password: $crypted_pass
-ssh:
-    install-server: yes
-    authorized-keys:
-      - $key
-    allow-pw: no
-snaps:
-    - name: go
-      channel: 1.14/stable
-      classic: true
-debconf-selections: |
-    bind9      bind9/run-resolvconf    boolean false
-packages:
-    - libreoffice
-    - dns-server^
-user-data:
-    disable_root: false
-late-commands:
-    - sed -ie 's/GRUB_TIMEOUT=.\*/GRUB_TIMEOUT=30/' /target/etc/default/grub
-error-commands:
-    - tar c /var/log/installer | nc 192.168.0.1 1000
-
- -Many keys and values correspond straightforwardly to questions the installer asks (e.g. keyboard selection). See the reference for details of those that do not. - -## Error handling - -Progress through the installer is reported via [the `reporting` system](/t/automated-server-install-reference/16613#reporting), including errors. In addition, when a fatal error occurs, the [`error-commands`](/t/automated-server-install-reference/16613#error-commands) are executed and the traceback printed to the console. The server then just waits. - -## Interactions between Autoinstall and Cloud-init - -### Delivery of Autoinstall - -Cloud-config can be used to deliver the autoinstall data to the installation environment. The [autoinstall quickstart](/t/automated-server-install-quickstart/16614) has an example of [writing the autoinstall config](/t/automated-server-install-quickstart/16614#write-your-autoinstall-config). - -Note that autoinstall is processed by Subiquity (not cloud-init), so please direct defects in autoinstall behavior and [bug reports to Subiquity](https://bugs.launchpad.net/subiquity/+filebug). - -### The installation environment - -At install time, the live-server environment is just that: a live but ephemeral copy of Ubuntu Server. This means that cloud-init is present and running in that environment, and existing methods of interacting with cloud-init can be used to configure the live-server ephemeral environment. For example, any #cloud-config user data keys are presented to the live-server containing [`ssh_import_id`]( https://cloudinit.readthedocs.io/en/latest/reference/modules.html#ssh-import-id), then SSH keys will be added to the `authorized_keys` list for the ephemeral environment. - -### First boot configuration of the target system - -Autoinstall data may optionally contain a [user data sub-section](/t/automated-server-install-reference/16613#user-data), which is cloud-config data that is used to configure the target system on first boot. - -Subiquity itself delegates some configuration items to cloud-init, and these items are processed on first boot. - -Starting with Ubuntu 22.10, once cloud-init has performed this first boot configuration, it will disable itself as cloud-init completes configuration in the target system on first boot. - -### Possible future directions - -We might want to extend the 'match specs' for disks to cover other ways of selecting disks. diff --git a/documentation/substitute-links.py b/documentation/substitute-links.py deleted file mode 100644 index 8a0557cbe..000000000 --- a/documentation/substitute-links.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -from typing import List, Tuple - -discourse_substitutions = [ - ("autoinstall.md", "/t/automated-server-installs/16612"), - ("autoinstall-reference.md", "/t/automated-server-install-reference/16613"), - ("autoinstall-quickstart.md", "/t/automated-server-install-quickstart/16614"), - ("autoinstall-schema.md", "/t/automated-server-install-schema/16615"), - ("autoinstall-quickstart-s390x.md", "/t/automated-server-install-schema/16616"), -] -md_to_html_substitutions = [ - ("autoinstall.md", "autoinstall.html"), - ("autoinstall-reference.md", "autoinstall-reference.html"), - ("autoinstall-quickstart.md", "autoinstall-quickstart.html"), - ("autoinstall-schema.md", "autoinstall-schema.html"), - ("autoinstall-quickstart-s390x.md", "autoinstall-quickstart-s390x.html"), -] - -def perform_substitutions(content: str, substitutions: List[Tuple[str, str]]) -> str: - for old, new in substitutions: - content = content.replace(old, new) - return content - - -def main() -> None: - parser = argparse.ArgumentParser() - - parser.add_argument("--input", "-i", type=argparse.FileType(mode="r"), default="-") - parser.add_argument("--output", "-o", type=argparse.FileType(mode="w"), default="-") - parser.add_argument("action", choices=("md-to-discourse", "md-to-html")) - - args = vars(parser.parse_args()) - - if args["action"] == "md-to-discourse": - substitutions = discourse_substitutions - else: - substitutions = md_to_html_substitutions - - print(perform_substitutions( - args["input"].read(), - substitutions=substitutions), - file=args["output"]) - - -if __name__ == "__main__": - main()