The Linux System Roles are a collection of roles and modules executed by Ansible to assist Linux admins in the configuration of common GNU/Linux subsystems. Conceptually, the intent is to serve as a consistent “API” to a give Linux distribution that is consistent across multiple major and minor releases. This collection is available in Ansible Galaxy at linux-system-roles.
Consistent and abstract
A major objective is that the role will provide a consistent user interface to provide settings to a given subsystem that is abstract from any particular implementation. For example, assigning an IP Address to a network interface should be a generic concept separate from any particular implementations such as init networking scripts, NetworkManager, or systemd-networkd.
Utilize the subsystems’ native libraries
Whenever possible, the modules for this effort will take advantage of the native libraries and interfaces provided by the distribution, rather than calling upon CLI commands. Example libraries include dbus, libnm, and similar interfaces which provide robust and strictly defined inputs.
Currently supported distributions
- Red Hat Enterprise Linux (RHEL 6+)
- RHEL 6+ derivatives such as CentOS 6+
Currently supported subsystems
Subsystems on the roadmap
- Red Hat Subscription Management
- system logging
- kerberos authentication
- tuned (power management)
Each subsystem is separated into individual repositories within the linux-system-roles GitHub project. Just open a new issue against the appropriate subsystem’s issue tracker to report bugs or request enhancements. New subsystem requests or feedback can be provided to the project’s landing page at linux-system-roles.github.io Pull requests welcome!
Sounds great! How do I try it out?
First, install Ansible on the system that you intend to use as your “control node”. See the Ansible Installation docs for instructions.
Next, pull these roles from Ansible Galaxy.
# ansible-galaxy install linux-system-roles.postfix # ansible-galaxy install linux-system-roles.kdump # ansible-galaxy install linux-system-roles.network # ansible-galaxy install linux-system-roles.selinux # ansible-galaxy install linux-system-roles.timesync
Here is an example playbook file we have named example-network.yml to test out the network role.
--- - hosts: TEST.local become: yes become_method: sudo become_user: root vars: network_connections: - name: DBnic state: up type: ethernet interface_name: eth1 autoconnect: yes ip: dhcp4: yes auto6: no roles: - role: linux-system-roles.network
Execute the playbook against your test machine, called TEST.local for this example.
# ansible-playbook -l TEST.local example-network.yml