README.md
1# ansible-freebsd-modules
2
3Ansible Modules for FreeBSD
4
5## Testing
6
7Testing requires Molecule, Vagrant & Virtualbox.
8
9## Module :: kld
10
11Loads the given kernel module, or puts it in the /boot/loader.conf
12
13### Parameters
14
15| Parameter | Choices/Defaults | Comments |
16| :-------- | :--------------- | :----- |
17| name | | Name of the kernel module. .ko is typically not needed |
18| load | Default: True | Load or unload the module |
19| boot | Default: True | Apply the kernel module at boot. |
20
21### Examples
22
23```yaml
24---
25# Adds accf_http to the bootloader and loads it
26- kld:
27 name: accf_http
28# Removes accf_http from the bootloader and loads it
29- kld:
30 name: accf_http
31 load: true
32 boot: false
33```
34
35## sysrc
36
37Uses [sysrc(8)](https://www.freebsd.org/cgi/man.cgi?query=sysrc) to set a sys var in /etc/rc.conf (default) or the given
38`$dest` file
39
40### Parameters
41
42| Parameter | Choices/Defaults | Comments |
43| :-------- | :--------------- | :----- |
44| dest | | The file to modify |
45| delim | ` ` | Delimiter. Used with append/subtract |
46| name | | Name of the variable to manage<br><strong>NOTE</strong>: cannot use `.` (periods) as sysrc doesn't support OID style names |
47| value | | Required when not `state=absent` |
48| state | **Choices**: <ul><li>append<li>absent</li><li>**present**</li><li>subtract</li></ul> | Whether the var should be appended, substracted, exist, or not exist. |
49
50### Examples
51
52```yaml
53---
54# enable mysql in the /etc/rc.conf
55- name: Configure mysql pid file
56 sysrc:
57 name: mysql_pidfile
58 value: "/var/run/mysqld/mysqld.pid"
59
60# enable accf_http kld in the boot loader
61- name: enable accf_http kld
62 sysrc:
63 name: accf_http_load
64 state: present
65 value: "YES"
66 dest: /boot/loader.conf
67
68# add gif0 to cloned_interfaces
69- name: add gif0 interface
70 sysrc:
71 name: cloned_interfaces
72 state: append
73 value: "gif0"
74```
75