Introduction
Ansible role: config_light
Requirements: ansible.posix, community.general, vbotka.freebsd
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, andsnapare used to install Linux packages. In FreeBSD, modulespkgngandportinstallare used to install FreeBSD packages and ports.states: The Ansible module
mountis used to mount and unmount paths, and to configure fstab. The modulefileis used to modify states of files.files: The Ansible modules
blockinfile,copy,ini_file,lineinfile,patch,replace,sysrc,template, anduclare used to configure files.services:
The module ansible.builtin.service is used to control Linux services.
The module vbotka.freebsd.service is used to control BSD 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 -> Examplesin the documentation vbotka.freebsd. Searchvbotka.freebsd.config_light,vbotka.freebsd.service, andvbotka.freebsd.uclin theIndex.
Hint
Feel free to share your feedback and report issues. The contributions to the project are welcome.