Fix #37 by removing inconsistencies in variable naming of

`samba_homes_include`
This commit is contained in:
Bert Van Vreckem 2019-06-22 17:16:09 +02:00
parent ce95f7adfb
commit 03a1920252
3 changed files with 41 additions and 38 deletions

View File

@ -31,38 +31,38 @@ No specific requirements
## Role Variables
| Variable | Default | Comments |
| :--- | :--- | :--- |
| `samba_apple_extensions` | no | When yes, enables support for Apple specific SMB extensions. Required for Time Machine support to work (see below) |
| Variable | Default | Comments |
| :--- | :--- | :--- |
| `samba_apple_extensions` | no | When yes, enables support for Apple specific SMB extensions. Required for Time Machine support to work (see below) |
| `samba_create_varwww_symlinks` | false | When true, symlinks are created in web docroot to the shares. (`var/www/` or `/var/www/html` depending on platform) |
| `samba_cups_server` | localhost:631 | Value for the global option `cups server` (only needed when `samba_printer_type` is "cups") |
| `samba_domain_master` | true | When true, smbd enables WAN-wide browse list collation |
| `samba_global_include` | - | Samba-compatible configuration file with options to be loaded to [global] section (see below) |
| `samba_guest_account` | - | Guest account for unknown users |
| `samba_home_include` | - | Samba-compatible configuration file with options to be loaded to [home] section (see below) |
| `samba_interfaces` | [] | List of network interfaces used for browsing, name registration, etc. |
| `samba_load_homes` | false | When true, user home directories are accessible. |
| `samba_load_printers` | false | When true, printers attached to the host are shared |
| `samba_local_master` | true | When true, nmbd will try & become local master of the subnet |
| `samba_log` | - | Set the log file. If left undefined, logging is done through syslog. |
| `samba_log_size` | 5000 | Set the maximum size of the log file. |
| `samba_log_level` | 0 | Set Samba log level, 0 is least verbose and 10 is a flood of debug output. |
| `samba_map_to_guest` | `bad user` | Behaviour when unregistered users access the shares. |
| `samba_mitigate_cve_2017_7494` | true | CVE-2017-7494 mitigation breaks some clients, such as macOS High Sierra. |
| `samba_netbios_name` | `{{ ansible_hostname }}` | The NetBIOS name of this server. |
| `samba_passdb_backend` | `tdbsam` | Password database backend. |
| `samba_preferred_master` | true | When true, indicates nmbd is a preferred master browser for workgroup |
| `samba_realm` | - | Realm domain name |
| `samba_printer_type` | cups | value for the global option `printing` and `printcap name` |
| `samba_security` | `user` | Samba security setting |
| `samba_server_max_protocol` | - | Specify a maximum protocol version offered by the server. |
| `samba_server_min_protocol` | - | Specify a minimum protocol version offered by the server. |
| `samba_server_string` | `fileserver %m` | Comment string for the server. |
| `samba_shares_root` | `/srv/shares` | Directories for the shares are created under this directory. |
| `samba_shares` | [] | List of dicts containing share definitions. See below for details. |
| `samba_users` | [] | List of dicts defining users that can access shares. |
| `samba_wins_support` | true | When true, Samba will act as a WINS server |
| `samba_workgroup` | `WORKGROUP` | Name of the server workgroup. |
| `samba_cups_server` | localhost:631 | Value for the global option `cups server` (only needed when `samba_printer_type` is "cups") |
| `samba_domain_master` | true | When true, smbd enables WAN-wide browse list collation |
| `samba_global_include` | - | Samba-compatible configuration file with options to be loaded to [global] section (see below) |
| `samba_guest_account` | - | Guest account for unknown users |
| `samba_homes_include` | - | Samba-compatible configuration file with options to be loaded to [homes] section (see below) |
| `samba_interfaces` | [] | List of network interfaces used for browsing, name registration, etc. |
| `samba_load_homes` | false | When true, user home directories are accessible. |
| `samba_load_printers` | false | When true, printers attached to the host are shared |
| `samba_local_master` | true | When true, nmbd will try & become local master of the subnet |
| `samba_log` | - | Set the log file. If left undefined, logging is done through syslog. |
| `samba_log_size` | 5000 | Set the maximum size of the log file. |
| `samba_log_level` | 0 | Set Samba log level, 0 is least verbose and 10 is a flood of debug output. |
| `samba_map_to_guest` | `bad user` | Behaviour when unregistered users access the shares. |
| `samba_mitigate_cve_2017_7494` | true | CVE-2017-7494 mitigation breaks some clients, such as macOS High Sierra. |
| `samba_netbios_name` | `{{ ansible_hostname }}` | The NetBIOS name of this server. |
| `samba_passdb_backend` | `tdbsam` | Password database backend. |
| `samba_preferred_master` | true | When true, indicates nmbd is a preferred master browser for workgroup |
| `samba_realm` | - | Realm domain name |
| `samba_printer_type` | cups | value for the global option `printing` and `printcap name` |
| `samba_security` | `user` | Samba security setting |
| `samba_server_max_protocol` | - | Specify a maximum protocol version offered by the server. |
| `samba_server_min_protocol` | - | Specify a minimum protocol version offered by the server. |
| `samba_server_string` | `fileserver %m` | Comment string for the server. |
| `samba_shares_root` | `/srv/shares` | Directories for the shares are created under this directory. |
| `samba_shares` | [] | List of dicts containing share definitions. See below for details. |
| `samba_users` | [] | List of dicts defining users that can access shares. |
| `samba_wins_support` | true | When true, Samba will act as a WINS server |
| `samba_workgroup` | `WORKGROUP` | Name of the server workgroup. |
### Defining users
@ -174,7 +174,7 @@ The values for `valid_users` and `write_list` should be a comma separated list o
## Adding arbitrary configuration files
You can add settings that are not supported by this role out-of-the-box through custom configuration files that will be included from the main configuration file. There are three types of include files: for the global section, for the homes section, and for individual shares. Put your custom configuration files in a subdirectory `templates`, relative to your master playbook location. Then, specify them in the variables `samba_global_include`, `samba_home_include`, or `include_file` in the `samba_shares` definition.
You can add settings that are not supported by this role out-of-the-box through custom configuration files that will be included from the main configuration file. There are three types of include files: for the global section, for the homes section, and for individual shares. Put your custom configuration files in a subdirectory `templates`, relative to your master playbook location. Then, specify them in the variables `samba_global_include`, `samba_homes_include`, or `include_file` in the `samba_shares` definition.
Your custom configuration files are considered to be Jinja templates, so you can use Ansible variables inside them. The configuration files will be validated to ensure they are syntactically correct.

View File

@ -94,8 +94,9 @@
when: samba_global_include is defined
notify:
- Restart Samba services
tags: samba
- name: Install homes include file
- name: Install home include file
template:
src: "{{ samba_homes_include }}"
dest: "{{ samba_configuration_dir }}"
@ -103,6 +104,7 @@
when: samba_homes_include is defined
notify:
- Restart Samba services
tags: samba
- name: Install share specific include files
template:
@ -113,6 +115,7 @@
notify:
- Restart Samba services
with_items: "{{ samba_shares }}"
tags: samba
- name: Create username map file if needed
template:
@ -120,8 +123,8 @@
src: smbusers.j2
notify:
- Restart Samba services
tags: samba
when: samba_username_map is defined
tags: samba
- name: Start Samba service(s)
service:

4
templates/smb.conf.j2 Executable file → Normal file
View File

@ -90,8 +90,8 @@
writable = yes
{% endif %}
{% if samba_home_include is defined %}
include = {{ samba_configuration_dir }}/{{ samba_home_include }}
{% if samba_homes_include is defined %}
include = {{ samba_configuration_dir }}/{{ samba_homes_include }}
{% endif %}
{% if samba_shares|length > 0 %}