svendewindt.deb_base

Read me

Build Status

Deb-Base

This role helps set up a Debian-like system with basic settings.

  • Manage users and groups
  • Manage software packages
  • Manage time zone
  • Set a message of the day
  • Customize bash and vim configurations

Requirements

No special requirements.

Role Variables

All variables are optional.

variable default explanation
apt_update_cache 3600 Time before apt cache expires, default 3600 seconds
install_core_packages ['sudo', 'ntp', 'locate', 'git', 'jq'] Default packages to install
remove_core_packages [] Packages to remove (none by default)
install_packages [] Additional packages to install
remove_packages [] Packages to remove
add_groups [] Groups to create
remove_groups [] Groups to delete
add_users [] Users to create
remove_users [] Users to delete
ssh_keys [] SSH keys to add (user must exist)
timezone Europe/Brussels Default time zone
custom_motd true Show a custom message of the day
custom_bashrc false Set a custom bashrc, default to standard
custom_vimrc false Set a custom vimrc

Managing users

This role makes it simple to create users and groups.

Example of adding users:

add_users:
      - username: 'johndoe'
        comment: 'John Doe'
        groups:
          - 'IT'
          - 'Admins'
        password: '$6$mlO/SXHhYGM0KKIG1PwN0...'

Password must be a SHA-512 hash starting with &6&. You can create this hash using https://www.mkpasswd.net/.

To add an SSH key for a user, ensure the user exists and add the key like this:

ssh_keys:
      - user: johndoe
        key: 'ssh-rsa AAAAB3... johndoe@PC-jd'

Managing packages

Some core packages will be automatically installed. These are needed on every machine. To add more packages, use install_packages.

Managing time zone

The NTP daemon will be installed and will run automatically. The default time zone is set to Europe/Brussels. You can find available time zones by running ls /usr/share/zoneinfo.

Set message of the day

A custom message will appear at login, showing the machine name and some interesting statistics.

Set custom bashrc and vimrc

This role will add colorful aliases in the bashrc and set up a colorful vimrc for better readability.

Example

---
- hosts: 127.0.0.1
  connection: local
  roles:
    - svendewindt.deb_base
  vars:
    install_packages: ['apache2']
    remove_packages: []
    add_users:
      - username: 'johndoe'
        comment: 'John Doe'
        groups:
          - 'IT'
          - 'Admins'
        password: '$6$mlO/SXHYGMSKKIF...'
    ssh_keys:
      - user: svdw
        key: 'ssh-rsa AAAAB3... johndoe@PC-JD'

License: MIT

Author: Sven de Windt

Informazioni sul progetto

Ansible role for basic setup of a server with Debian based distribution.

Installa
ansible-galaxy install svendewindt.deb_base
Licenza
mit
Download
141
Proprietario