Forked from HanXHX/ansible-debian-bootstrap to deploy only Debian servers. Do not use it if you want to bootstrap Ubuntu/Devuan/Raspbian servers.
This role bootstraps Debian hosts:
- Configure APT (sources.list)
- Install minimal packages (vim, htop...)
- Add groups, users with SSH key, sudoers
- Deploy bashrc, vimrc for root
- Update few alternatives
- Configure system: hostname, timezone and locale
- Sysctl tuning
Supported versions
| OS | Working | Stable (active support) |
|---|---|---|
| Debian Bullseye (11) | Yes | Yes |
| Debian Bookworm (12) | Yes | Yes |
- Ansible >= 2.11
- Collections: ansible.posix collection / community.general
Theses variables define hostname to configure APT (normal repo and backports):
dbs_apt_default_host: repository host. It can replace the last one (installed with this role) with a new onedbs_apt_use_src: install "deb-src" repositories (default: false)dbs_apt_components: components uses in sources.list (default: "main contrib non-free")
dbs_set_hostname: if true, change hostnamedbs_clean_hosts: if true, manages/etc/hostsfiledbs_set_locale: if true, configure localesdbs_set_timezone: if true, set timezonedbs_set_apt: if true, configure APT repository
dbs_hostname: system hostnamedbs_hostname_use_strategy: strategy used to set hostname check "use" in hostname module. You should update this var only if hostname fails (in LXC for example).dbs_default_locale: default system localedbs_locales: list of installed localesdbs_timezone: system timezone. If you need a "standard" timezone like UTC, you must use prefix "Etc/" (ex: "Etc/UTC")dbs_sysctl_config: hash of kernel parameters, see: default/main.ymldbs_use_systemd: delete systemd if set to false (persistent)dbs_use_dotfiles: overwrite root dotfiles (bashrc, screenrc, vimrc)dbs_uninstall_packages: packages list to uninstall
dbs_alternative_editordbs_alternative_awk
dbs_groups: list of groups
Each row have few keys:
name: (M) username on systemsystem: (O) yes/no (default: no)state: (O) present/absent (default: present)
(M) Mandatory (O) Optionnal
dbs_users: list of user
Each row have few keys:
name: (M) username on systempassword: (O) password with hash format (see ansible doc)clear_password: (O) password as clear format (not recommanded)update_password: (O) always / on_createshell: (O) default is /bin/bashcomment: (O) default is an empty stringsudo: (O) boolean (true = can sudo)group: (O) main group (default isnamewithout password)groups: (O) comma separated list of groupscreatehome: (O) yes/no (default is yes)system: (O) yes/no (default: no)ssh_keys: (O) ssh public keys liststate: (O) present/absent (default: present)
(M) Mandatory (O) Optionnal
Notes:
- if
passwordis specified,clear_passwordis not used! clear_passwordis not idempotent withupdate_password= always (default)
For more information, look ansible user module doc.
dbs_packages: list of packages to installdbs_distro_packages: list specific package to install (related to OS version)dbs_is_docker: boolean. Is true if current is a docker container
None.
-
Twitter: @hanxhx_
- hosts: servers
roles:
- { role: HanXHX.debian_bootstrap }
- hosts: servers
roles:
Due to Docker limitations, theses features are disabled:
- Setting hostname
- Configure sysctl
Install vagrant + libvirt or docker
vagrant up debian-bullseye # with libvirt (or whatever)
vagrant up docker-debian-bullseye # with docker
GPLv2
- Twitter: @hanxhx_