Introduction

The role installs packages, creates and configures files and services. The handlers are created from user-provided data. The user-provided configuration data determines the control flow. Some attributes of the dictionaries determine which Ansible module will be used. This data-driven programming paradigm provides a flexible and robust framework to apply basic Ansible modules. Each Ansible module is used only once in the code. This makes the modules’ implementation, upgrading, and testing simple and easy.

The user of this role is expected to master at least the following Ansible topics:

The supported OS (FreeBSD and Ubuntu) can use the role to install and configure arbitrary applications. The other Linux distributions that support the used Ansible modules should work with minimal changes. BSD*, Debian, and Red Hat ansible_os_family should work out of the box.

There are four imported tasks in the first part of the role to setup handlers, assemble, test, and display the configuration data:

tasks     description                  tags               enabled (default)
___________________________________________________________________________
setup     create handlers              cl_setup           cl_setup=true
vars      assemble configuration data  cl_vars, always
sanity    test sanity                  cl_sanity          cl_sanity=true
debug     display configuration data   cl_debug           cl_debug=false

Next, there are four imported tasks to manage the systems:

tasks     description                  tags               enabled (default)
___________________________________________________________________________
packages  install packages             cl_packages        cl_install=true
states    modify states of files       cl_states
files     configure files              cl_files
services  configure services           cl_services
  • packages: The Ansible modules package, apt, dnf, and snap are used to install Linux packages. In FreeBSD, modules pkgng and portinstall are used to install FreeBSD packages and ports.

  • states: The Ansible module mount is used to mount and unmount paths, and to configure fstab. The module file is used to modify states of files.

  • files: The Ansible modules blockinfile, copy, ini_file, lineinfile, patch, replace, sysrc, template, and ucl are used to configure files.

  • services:

Note

For backward compatibility use yum instead of dnf in the configuration. For example

shell> cat conf-light/packages.d/lighttpd.yml
lighttpd:
  module: yum
  name:
    - lighttpd

The module ansible.builtin.dnf will be used. See packages.yml

See also

  • The directory contrib comprises examples of installation and configuration of various applications. Some of them are commented Examples.

  • The User's Guide -> Examples in the documentation vbotka.freebsd. Search vbotka.freebsd.config_light, vbotka.freebsd.service, and vbotka.freebsd.ucl in the Index.

Hint

Feel free to share your feedback and report issues. The contributions to the project are welcome.