System configuration

Manage Services

In most cases, the tasks-group rcconf.yml is used to configure and manage a service. For example, to configure sshd set the variable _service=sshd and import fn/rcconf.yml

- name: "Sshd: Configure rc.conf"
  tags: fp_sshd_rcconf
  vars:
    _service: sshd
  ansible.builtin.import_tasks: fn/rcconf.yml

See also

A few variables control the execution flow of these imported tasks.

See also

  • defaults/main/rcconf.yml

  • defaults/main/rcconfd.yml

  • defaults/main/handlers.yml

fp_rcconfd

Use /etc/rc.conf.d or /etc/rc.conf. By default fp_rcconfd=false /etc/rc.conf is used.

fp_rcconfd_path

The dictionary of files used in /etc/rc.conf.d. By default the dictionary is trivial

fp_rcconfd_file:
  apcupsd: apcupsd
  devd: devd
  devfs: devfs
 ...

Note

  • The filename in /etc/rc.conf.d/ must be identical to the name of the rc script (service).

  • The configuration in /etc/rc.conf.d/ overrides /etc/rc.conf

See also

The dictionary fp_rcconfd_file is used to create the dictionary of paths fp_rcconfd_path

fp_rcconfd_path: "{{ dict(fp_rcconfd_file.keys()
                          | zip([fp_rcconfd_dir]
                                | product(fp_rcconfd_file.values())
                                | map('join', '/'))) }}"

fp_rcconf_var

The dictionary of the fp_<tasks-group>_enable variables

fp_rcconf_var:
  default: "fp_{{ _service }}_enable"

fp_rcconf_rcvar

The dictionary of the rcvar variables

fp_rcconf_rcvar:
  default: "{{ _service }}_enable"
  devfs: devfs_load_rulesets
  qemu: "{{ fp_qemu_rcvar }}"

fp_handlers

The lists of handlers for the service rcvar values

fp_handlers:
  default:
    "YES": ["start {{ _service }}"]
    "NO": ["stop {{ _service }}"]
    "RELOAD": ["reload {{ _service }}"]
  devd:
    "RELOAD": [restart devd]
  devfs:
    "RELOAD": [restart devfs]
  linux:
    "RELOAD": [restart linux]
  ntpdate:
    "RELOAD": [restart ntpdate]
  ntpd:
    "RELOAD": [restart ntpd]

fp_{{ _service }}_rcconf

List of service configuration. For example,

fp_ntpd_sync_on_start: "YES"
fp_ntpdate_rcconf:
  - { name: ntpd_sync_on_start, value: "{{ fp_ntpd_sync_on_start }}" }

The default is an empty list.

fp_{{ _service }}_notify

Boolean. Notify handlers fp_handlers. The default is true

fp_{{ _service }}_service_task

Boolean. Do not wait for the hanlers. Start/Stop a service right after the configuration. The default is false.