DEBOPS.PRESEED(5)

NAME
debops.preseed - Manage Debian Preseeding configuration with Ansible

SYNOPSIS

debops service/preseed [--limit group,host,...] [--diff] [--check] [--tags tag1,tag2,...] [--skip-tags tag1,tag2,...] [<ansible-playbook options>] ...

DESCRIPTION

Preseeding <https://wiki.debian.org/DebianInstaller/Preseed> is a way to configure the Debian Installer non-interactively. During installation, a special text file can be downloaded over HTTP, this file can provide answers to the installer questions.

After installation, a custom shell script will be downloaded and run in the target environment to prepare host for remote use (an admin account will be created, SSH keys will be configured, optionally a Salt Minion will be installed and will start on the next boot).

GETTING STARTED

  Example inventory

To configure the Preseed server, you can add a host to [debops_service_preseed] group:

[debops_service_preseed]
hostname

Default configuration will prepare Preseed files for Debian Wheezy and Debian Jessie, which system administrator account named after either ansible_ssh_user or the username present on Ansible Controller host.

  Example playbook

Here's an example playbook which uses debops.preseed role:

---
- name: Provide Debian Preseed configuration files over HTTP
  collections: [ 'debops.debops', 'debops.roles01',
                 'debops.roles02', 'debops.roles03' ]
  hosts: [ 'debops_service_preseed' ]
  become: True
  environment: '{{ inventory__environment | d({})
                   | combine(inventory__group_environment | d({}))
                   | combine(inventory__host_environment  | d({})) }}'
  roles:
    - role: keyring
      tags: [ 'role::keyring', 'skip::keyring', 'role::nginx' ]
      keyring__dependent_apt_keys:
        - '{{ nginx__keyring__dependent_apt_keys }}'
    - role: apt_preferences
      tags: [ 'role::apt_preferences', 'skip::apt_preferences' ]
      apt_preferences__dependent_list:
        - '{{ nginx_apt_preferences_dependent_list }}'
    - role: ferm
      tags: [ 'role::ferm', 'skip::ferm' ]
      ferm__dependent_rules:
        - '{{ nginx_ferm_dependent_rules }}'
    - role: python
      tags: [ 'role::python', 'skip::python' ]
      python__dependent_packages3:
        - '{{ nginx__python__dependent_packages3 }}'
      python__dependent_packages2:
        - '{{ nginx__python__dependent_packages2 }}'
    - role: nginx
      tags: [ 'role::nginx', 'skip::nginx' ]
      nginx_servers: '{{ preseed__nginx__servers }}'
    - role: preseed
      tags: [ 'role::preseed', 'skip::preseed' ]

  How to use Debian Preseed configuration

debops.preseed will use debops.nginx role to set up a webserver for the Preseed files. They will be served on a separate subdomain, by default seed. The FQDN given the example.org domain will be for example:

debian.seed.example.org
debian-vm.seed.example.org

You will need to define these subdomains in your DNS server, preferably as a CNAME records pointed to the Preseed server.

If you have correctly configured DHCP server, which advertises your domain, you will be able to access the Preseed configuration using a shorter form:

debian.seed
debian-vm.seed

The Debian Installer will automatically add your domain to the specified URL to get the Preseed files.

To enable Preseeded installation, after starting the Debian Installer (tested with Wheezy and Jessie), navigate the menu to "Advanced options" -> "Automated Install".

Next, press the <Tab> key, this will let you enter additional boot options. Now you can specify the URL of the Preseed file.

An example boot command line in Debian Installer:

auto=true url=debian.seed hostname=<host>

After you press <Enter>, the Debian Installer should start the installation process. If you specified debian.seed as the Preseed file, the Debian Installer should pause during the installation and let you configure the disk partitions as you see fit. After configuring the partitions, the automatic installation will resume and when it's finished the host will be automatically rebooted. After that you should be able to SSH to it using the configured admin account.

The alternative Pressed configuration, debian-vm.seed is configured to automatically partition and format the first hard drive with its full capacity, without asking the user. This Preseed configuration is designed primary for virtual machines, which usually have 1 partition stored in an image file or a block device.

If you are not able to add *.seed to your DNS, you might use preseed__base_domain to make the server listen on a hostname available via DNS. For this case the boot command line in Debian Installer would require a different URL, like in this example (for jessie):

auto url=<myhost>/debian/d-i/jessie hostname=<host>

DEFAULT VARIABLE DETAILS

Some of debops.preseed default variables have more extensive configuration than simple strings or lists, here you can find documentation and examples for them.

  preseed__configs

This is a list of Preseed configuration files offered by the webserver to the clients.

To make custom changes easier, preseed configuration file as well as the post-install script have default stored in the templates themselves, a subset of the available default variables is exposed in the defaults/main.yml file, however more esoteric variables were left out to keep the list of variables short.

You can also configure the Preseed files using dict keys and values, the variable naming scheme is:

preseed__debian_<key> - item.<key>

Some more important keys:

name
    Name of the Preseed configuration, should be limited to alphanumeric characters and a hyphen (-) character. Will be used in the DNS do export the configuration to the clients

type
    Specify the set of Preseed templates to use for this configuration. Determines among other things the distribution which will be configured

release
    Specify the distribution release to configure. By default the current host release is used if none is specified

  Examples

Example Preseed configuration with custom mirror and list of additional packages to install:

preseed__configs:
  - name: 'debian-mail'
    release: 'wheezy'
    mirror_hostname: 'ftp.us.debian.org'
    packages: [ 'postfix', 'dovecot-imapd', 'mutt' ]

AUTHOR
Maciej Delmanowski, Robin Schneider

COPYRIGHT
2014-2022, Maciej Delmanowski, Nick Janetakis, Robin Schneider and others