HanXHX.freebsd-bootstrap
Ansible FreeBSD bootstrap role
This role bootstraps FreeBSD server:
- Install and configure ports
- Install minimal packages (vim, htop...)
- Install CPU microcode if needed
- Install and configure NTP daemon NTP
- Add groups, users with SSH key, sudoers
- Deploy bashrc, vimrc for root
- Configure system: hostname and timezone
- Sysctl tuning
Supported versions
| OS | Working | Stable (active support) |
|---|---|---|
| FreeBSD 11 | Yes | Yes |
| FreeBSD 12 | Yes | Yes |
Need the same role Debian? Check this!
Requirements
None.
Role Variables
Role setup
fbs_set_hostname: if true, change hostnamefbs_clean_hosts: if true, manages/etc/hostsfilefbs_set_locale: if true, configure localesfbs_set_timezone: if true, set timezonefbs_set_ntp: if true, install and configure OpenNTPdfbs_set_apt: if true, configure APT repository
System configuration
fbs_hostname: system hostnamefbs_default_locale: default system localefbs_locales: list of installed localesfbs_timezone: system timezone. If you need a "standard" timezone like UTC, you must use prefix "Etc/" (ex: "Etc/UTC")fbs_sysctl_config: hash of kernel parameters, see: default/main.ymlfbs_use_systemd: delete systemd if set to false (persistent)fbs_use_dotfiles: overwrite root dotfiles (bashrc, screenrc, vimrc)
NTPd
fbs_ntp_hosts: hostnames NTP server list
Group
fbs_groups: list of group
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
User
fbs_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/nosystem: (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.
Dependencies
None.
Example Playbook
See tests/test.yml.
License
GPLv2
Donation
If this code helped you, or if you’ve used them for your projects, feel free to buy me some :beers:
- Bitcoin:
1BQwhBeszzWbUTyK4aUyq3SRg7rBSHcEQn - Ethereum:
63abe6b2648fd892816d87a31e3d9d4365a737b5 - Litecoin:
LeNDw34zQLX84VvhCGADNvHMEgb5QyFXyD - Monero:
45wbf7VdQAZS5EWUrPhen7Wo4hy7Pa7c7ZBdaWQSRowtd3CZ5vpVw5nTPphTuqVQrnYZC72FXDYyfP31uJmfSQ6qRXFy3bQ
No crypto-currency? :star: the project is also a way of saying thank you! :sunglasses:
Author Information
- Twitter: @hanxhx_
