Bootstrap a FreeBSD host.
This role is split into two phase because the first phase is carried
as root
and the second phase is a configuration phase (idempotent) which
is carried as the non root superuser.
- connect as
root
- install python
- install sudo
- allow ttyless sudo
- create a user named
boostrap_username
and give him passwordless sudo power - copy the ssh key at path
bootstrap_sshkey
to the newly created superuser
- connect as newly created superuser
- disable ssh root login
- remove root password
- enable ntp
- enable daily auto update
- setup the machine to use ssmtp (optional)
- install runit (without replacing init)
- install rsyslog
bootstrap_username
, the name of the superuser to create, default toadmin
boostrap_sshkey
, the path to the ssh key to add to the superuser, default to~/.ssh/id_rsa.pub
bootstrap_phase
, the bootstrap phase to execute
You may enable ssmtp by setting the following variables:
bootstrap_ssmtp_server
, smtp server, can have a port number like smtp.gmail.com:587bootstrap_ssmtp_root
, the email of the root user (will get all emails)bootstrap_ssmtp_user
, smtp usernamebootstrap_ssmtp_pass
, smtp passwordbootstrap_ssmtp_domain
, the root domain to use as senderbootstrap_ssmtp_tls
, set to true to use TLS
The following tags are supported to execute only one part of phase 2.
bootstrap_password
, disable root loginbootstrap_ntp
, install ntpbootstrap_autoupdate
, setup autoupdatebootstrap_ssmtp
, setup ssmtp (ssmtp configuration must also be set)bootstrap_runit
, setup runitbootstrap_fstab
, setup fstab (mount linux proc)bootstrap_packages
, install base packagesbootstrap_locale
, set default locale to UTF-8bootstrap_syslog
, setup rsyslog instead of syslog
You need two playbooks to use this role, the first one, that should only be executed once:
---
- hosts: servers
remote_user: root
gather_facts: false # Should be false as python is not installed yet
roles:
- {role: kuon.freebsd-bootstrap, bootstrap_phase: 1}
---
- hosts: servers
sudo: true
remote_user: admin # Should be the same as bootstrap_username
roles:
- {role: kuon.freebsd-bootstrap, bootstrap_phase: 2}
MIT
Nicolas Goy (@kuon)