Skip to content

vbotka/ansible-freebsd-postinstall

Repository files navigation

freebsd_postinstall

quality Build Status Documentation Status GitHub tag

Ansible role vbotka.freebsd_postinstall at galaxy.ansible.com

FreeBSD post-install configuration: aliases, apcupsd, authorized keys, cron, devfs, dhclient, freebsd-update, fstab, groups, hostapd, hostname, hosts, inetd, libmap, linux compatibility, login.conf, loader.conf, make.conf, motd, nfsd, ntpd, ntpdate, procmail, qemu, resolvconf.conf, smartd, snmpd, sudoers, ssh, sshd, swap, sysctl, syslog, timezone, tmpmfs, users, packages and ports, periodic.conf, overlays, wpa_supplicant, (wip) ...

Documentation Ansible role FreeBSD postinstall at readthedocs.io

This role and the documentation is work in progress. If the documentation of a task is missing it's necessary to review the source code to learn how to use it. If a functionality is missing consider role config_light. See various examples. If config_light is not able to do what you want create new tasks.

Feel free to share your feedback and report issues.

Contributions are welcome.

Supported platforms

This role has been developed and tested with FreeBSD Supported Releases.

Requirements and dependencies

Roles

Collections

Packages

See the dictionaries pkg_dict_* in defaults/main/pkgdict_*.yml

Variables

Review defaults and examples in vars.

freebsd_install_method

By default freebsd_install_method is set to install packages. Installation is faster. But, later, after having upgraded from the ports (portmaster -a) switch the method to ports.

freebsd_install_method: packages
#freebsd_install_method: ports
#freebsd_use_packages: true

Optionally, the packages can be built by freebsd_poudriere and installed by freebsd_packages

freebsd_use_packages

Role freebsd_ports will install packages if this option is set.

#freebsd_install_method: packages
freebsd_install_method: ports
freebsd_use_packages: true

Workflow

  1. On the remote hosts, change shell to /bin/sh for the remote user if necessary
ansible host -e ansible_shell_type=csh -e ansible_shell_executable=/bin/csh -a 'sudo pw usermod user -s /bin/sh'
  1. Install the roles
ansible-galaxy role install vbotka.freebsd_postinstall
ansible-galaxy role install vbotka.ansible_lib

and install the collections if necessary

ansible-galaxy collection install ansible.posix
ansible-galaxy collection install community.general
  1. Fit variables to your needs.

  2. Create playbook

cat freebsd-postinstall.yml
- hosts: host
  roles:
    - vbotka.freebsd_postinstall

See the Best practice.

  1. Configure the system
ansible-playbook freebsd-postinstall.yml

Ansible lint

Use the configuration file .ansible-lint.local when running ansible-lint. Some rules might be disabled and some warnings might be ignored. See the notes in the configuration file.

shell> ansible-lint -c .ansible-lint.local

Configure the role

The playbook .configure.yml provides blocks of tasks to configure the role. Read it to understand the details.

Notes

  1. devfs

"/etc/rc.d/devfs rcvar" returns no variable. As a result module "system" fails

fatal: [srv.example.com]: FAILED! => changed=false
  msg: unable to determine rcvar

To solve this problem apply the patch below

--- devfs.orig	2019-07-13 20:31:04.688022000 +0200
+++ devfs	2019-07-13 20:34:49.347159000 +0200
@@ -11,6 +11,7 @@
 . /etc/rc.subr

 name="devfs"
+rcvar="devfs_load_rulesets"
 desc="Device filesystem"
 start_cmd='devfs_start'
 stop_cmd=':'

License

license

Author Information

Vladimir Botka

References

Cloud providers

About

Ansible role. Post-install configuration of FreeBSD.

Resources

License

Stars

Watchers

Forks

Packages

No packages published