An Ansible Role that installs base packages and sets the timezone and locale on Ubuntu and Debian, created with Phansible in mind.
- Ubuntu 22.04, 24.04, 26.04 or Debian 12, 13 (x86_64)
- Ansible >= 2.15 with the
community.generalcollection (bundled with theansiblepackage, install it separately if you only haveansible-core) - Root access or
becomeon the target
All settings live in a single server dictionary, defined in defaults/main.yml:
server:
timezone: UTC
locale: en_GB.UTF-8
packages: []| Key | Default | Description |
|---|---|---|
server.timezone |
UTC |
Name under /usr/share/zoneinfo, written to /etc/timezone and linked to /etc/localtime |
server.locale |
en_GB.UTF-8 |
Locale generated with locale-gen (it is not set as the system default) |
server.packages |
[] |
Extra apt packages to install at their latest version |
curl, wget, ca-certificates, tzdata and locales are always installed. Ansible replaces dictionaries rather than merging them, so when you override server set all three keys.
None.
- hosts: all
become: yes
vars:
server:
timezone: Europe/London
locale: en_GB.UTF-8
packages: [git, vim]
roles:
- role-serverThis role is released under the terms of the license specified in the repository or if not specified, under the MIT license.
This role was created in 2015 by The Phansible Team & Contributors, credits go also to Jeff Geerling, author of Ansible for DevOps and source of inspiration.