HanXHX.debian_bootstrap

Ansible Debian/Devuan/Ubuntu/Raspbian Bootstrap

This guide explains how to set up a role using Ansible to prepare Debian, Devuan, Ubuntu, or Raspbian systems.

Features

  • Configure APT package manager
  • Install basic packages like vim and htop
  • Install Intel/AMD microcode if needed
  • Set up NTP (Network Time Protocol) for time synchronization using OpenNTPd or NTP
  • Create user groups, users with SSH keys, and sudo privileges
  • Set up configuration files like bashrc and vimrc for the root user
  • Update system settings such as hostname, timezone, and locale
  • Option to remove systemd if preferred
  • Tuning system parameters

Supported Versions

OS Working Stable Support
Debian Stretch (9) Yes No
Debian Buster (10) Yes Yes
Debian Bullseye (11) Yes Yes
Debian Bookworm (12) Yes Yes
Devuan Ascii (2) Yes No
Raspbian Stretch (9) Experimental No
Raspbian Buster (10) Experimental No
Raspbian Bullseye (11) Experimental No
Ubuntu Bionic (18.04) Yes No
Ubuntu Focal (20.04) Experimental No
Ubuntu Jammy (22.04) Experimental No

Requirements

Role Variables

  • APT Configuration: Set up the APT repository.

    • dbs_apt_default_host: Host to use for repositories.
    • dbs_apt_use_src: Install source repositories (default: false).
  • Role Setup: Configure basic system settings.

    • dbs_set_hostname: Change the hostname if true.
    • dbs_set_timezone: Set the system timezone.
  • System Configuration: Define system parameters.

    • dbs_hostname: The system's hostname.
    • dbs_timezone: The timezone; use "Etc/" for standard time (e.g. "Etc/UTC").
  • User Configuration: Manage user accounts.

    • dbs_users: List of users with details (username, password, permissions, etc.).

Example Playbook

Here's a sample playbook to use this role:

- hosts: servers
  roles:
     - { role: HanXHX.debian_bootstrap }

Docker Considerations

Some features are not available when using Docker:

  • Removing systemd
  • Changing hostname
  • Configuring sysctl settings.

Development and Testing

You can test this role using Vagrant or Molecule:

  • Vagrant: Install Vagrant and create a virtual machine.

    vagrant up debian-bullseye
    
  • Molecule: Install with pip.

    pip install molecule molecule[docker]
    

    Run the tests.

    molecule -vv -c molecule/_shared/base.yml converge -s ubuntu-22.04
    

License

This project is licensed under GPLv2.

Donations

If this code has been helpful, feel free to support me with a donation in cryptocurrency. Thank you!

Author Information

You can follow the author on Twitter: @hanxhx_.

Informazioni sul progetto

Normalize and prepare a Debian/Devuan/Ubuntu Linux server

Installa
ansible-galaxy install HanXHX.debian_bootstrap
Licenza
gpl-2.0
Download
6.5k
Proprietario
CEO/CTO/SRE triplestack.fr / daemonit.com