Gwerlas.system
Base System
===========
This document covers the basic settings for Linux systems.
Using roles in containers is not very common, but it is possible for testing Ansible with Molecule. In such cases, only the package manager cache will be set up and updated if necessary. Other system components will not be managed, as that is the responsibility of the container engine.
GitLab project link: yoanncolin/ansible/roles/system
Requirements
This role is intended to run as a non-root user, so Sudo must be installed and configured.
For network configuration, the netaddr Python package is required, along with the ansible.utils Ansible module.
For managing filesystems, the jmespath Python package is necessary, along with the community.general and ansible.posix Ansible modules.
Facts
This role defines the following facts:
system_packagessystem_shellssystem_sudo_version
For more details, refer to the facts documentation.
Tags
You can update some values quickly using tags, such as:
ca- SSL certificate authoritiesfirewallhosts- Update the/etc/hostsfilenetworkspackagesproxiesstoragessudoerstimeusers
Usage Example:
ansible-playbook -t tag1[,tag2[,...]] my_play.yml
Tasks
System components are managed through separate tasks that can be called independently.
All tasks are called in the main.yml file. Check the documentation for each task:
Role Variables
Feature Flipping
To enable or disable features, refer to defaults/main/feature-flipping.yml. You can set features to true or false.
Shared Variables
Refer to defaults/main/shared.yml.
system_bin_path: /usr/local/bin
system_profile: server
system_retries: 2
Some distributions do not have a command line option to easily check if a reboot is needed or if the package cache is outdated. Therefore, we provide scripts to help with that.
You can change the location of these scripts through the system_bin_path.
The system_profile can affect the behavior of parts of the system, such as which packages to install (or skip).
If you face network issues during installation, you can increase the value of system_retries.
Dependencies
A Linux system that is reachable and has Python installed.
Example Playbook
For the first deployment or a distribution upgrade, here’s a rolling update example with 10 steps:
---
- name: Rolling update
hosts: all
serial: 10%
roles:
- role: gwerlas.system
vars:
system_packages_upgrade: true
To use just one task:
---
- name: Package managers
hosts: all
tasks:
- name: Prepare the package manager
ansible.builtin.import_role:
name: gwerlas.system
tasks_from: package-managers
License
This project uses the BSD 3-Clause License.
ansible-galaxy install Gwerlas.system