W3cubDocs

/Ansible 2.11

community.general.sysrc – Manage FreeBSD using sysrc

Note

This plugin is part of the community.general collection (version 2.0.1).

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.sysrc.

New in version 2.0.0: of community.general

Synopsis

  • Manages /etc/rc.conf for FreeBSD.

Parameters

Parameter Choices/Defaults Comments
delim
string
Default:
" "
Delimiter to be used instead of .
Only used when state=value_present or state=value_absent.
jail
string
Name or ID of the jail to operate on.
name
string / required
Name of variable in /etc/rc.conf to manage.
path
string
Default:
"/etc/rc.conf"
Path to file to use instead of /etc/rc.conf.
state
string
    Choices:
  • absent
  • present
  • value_present
  • value_absent
Use present to add the variable.
Use absent to remove the variable.
Use value_present to add the value to the existing variable.
Use value_absent to remove the value from the existing variable.
value
string
The value to set when state=present.
The value to add when state=value_present.
The value to remove when state=value_absent.

Notes

Note

  • The name cannot contain periods as sysrc does not support OID style names.

Examples

---
# enable mysql in the /etc/rc.conf
- name: Configure mysql pid file
  community.general.sysrc:
    name: mysql_pidfile
    value: "/var/run/mysqld/mysqld.pid"

# enable accf_http kld in the boot loader
- name: Enable accf_http kld
  community.general.sysrc:
    name: accf_http_load
    state: present
    value: "YES"
    path: /boot/loader.conf

# add gif0 to cloned_interfaces
- name: Add gif0 interface
  community.general.sysrc:
    name: cloned_interfaces
    state: value_present
    value: "gif0"

# enable nginx on a jail
- name: Enable nginx in test jail
  community.general.sysrc:
    name: nginx_enable
    value: "YES"
    jail: testjail

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
changed
boolean
always
Return changed for sysrc actions.

Sample:
True


Authors

  • David Lundgren (@dlundgren)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/community/general/sysrc_module.html