Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

[READ-ONLY] Ansible role dealing with the setup of Systemd

Notifications You must be signed in to change notification settings

manala/ansible-role-systemd

Repository files navigation

#######################################################################################################

❗ DEPRECATION ❗

This repository and the role associated are deprecated in favor of the Manala Ansible Collection

You will find informations on its usage on the collection repository

#######################################################################################################

Ansible Role: Systemd Build Status

Report issues and send Pull Requests in the main Ansible Role repository

This role will deal with the setup of Systemd.

It's part of the Manala Ansible stack but can be used as a stand alone component.

Requirements

None.

Dependencies

None.

Installation

Ansible 2+

Using ansible galaxy cli:

ansible-galaxy install manala.systemd

Using ansible galaxy requirements file:

- src: manala.systemd

Role Variables

Name Default Type Description
manala_systemd_system_configs_exclusive false Boolean Exclusion of existings files
manala_systemd_system_configs_dir '/etc/systemd/system' String Path to the system configuration directory
manala_systemd_system_configs_defaults {} Array System configs defaults
manala_systemd_system_configs [] Array System configs
manala_systemd_tmpfiles_configs_exclusive false Boolean Exclusion of existings files
manala_systemd_tmpfiles_configs_dir '/etc/tmpfiles.d' String Path to the tmpfiles configuration directory
manala_systemd_tmpfiles_configs_defaults {} Array Tmpfiles configs defaults
manala_systemd_tmpfiles_configs [] Array Tmpfiles configs
manala_systemd_services [] Array Services

| manala_telegraf_configs_exclusive | false | Array | Additional configurations exclusivity | | manala_telegraf_configs_dir | '/etc/telegraf/telegraf.d' | String | Additional configurations directory path | | manala_telegraf_configs_defaults | {} | Array | Additional configurations defaults | | manala_telegraf_configs | [] | Array | Additional configurations directives |

Configuration example

manala_systemd_system_configs_exclusive: true

manala_systemd_system_configs:
  # Content based
  - file: content.conf
    config: |
      [Service]
      PrivateTmp=no
      PrivateDevices=no
      PrivateNetwork=no
  # Template based (file name based on template)
  - template: systemd/system/bar.conf.j2
    config:
      foo: bar
  # Template based (force file name)
  - file: baz.conf
    template: systemd/system/bar.conf.j2
    config:
      foo: bar
  # Dicts array based (deprecated)
  - file: deprecated.conf
    config:
      - Description=OpenBSD Secure Shell session cleanup
  # Ensure config is absent
  - file: absent.conf
    state: absent # "present" by default
  # Ignore config
  - file: ignore.conf
    state: ignore
  # Flatten configs
  - "{{ my_custom_systemd_system_configs_array }}"

# Mask redis service
manala_systemd_services:
  - name: redis-server
    masked: true

Configuration example (tmpfiles.d)

manala_systemd_tmpfiles_configs_exclusive: true

manala_systemd_tmpfiles_configs:
  # Content based
  - file: content.conf
    config: |
      d /var/run/mysqld 0755 mysql mysql -
  # Template based (file name based on template)
  - template: systemd/tmpfiles/bar.conf.j2
    config:
      foo: bar
  # Template based (force file name)
  - file: baz.conf
    template: systemd/tmpfiles/bar.conf.j2
    config:
      foo: bar
  # Dicts array based (deprecated)
  - file: deprecated.conf
    config:
      - d: /var/run/mysqld 0755 mysql mysql -
  # Ensure config is absent
  - file: absent.conf
    state: absent # "present" by default
  # Ignore config
  - file: ignore.conf
    state: ignore
  # Flatten configs
  - "{{ my_custom_systemd_tmpfiles_configs_array }}"

Example playbook

- hosts: servers
  roles:
    - role: manala.systemd

Licence

MIT

Author information

Manala (http://www.manala.io/)