Skip to content

Commit

Permalink
Merge pull request #165 from vladgh:fix/boolean
Browse files Browse the repository at this point in the history
Fix boolean values
  • Loading branch information
vladgh authored May 9, 2024
2 parents ca42479 + 4138b8e commit 9a7e7d1
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 39 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Alternatively, you can directly import the existing playbook:

| 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_apple_extensions` | `true` | 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_enable_netbios` | `true` | When false, the NMB daemon is disabled by setting `disable netbios` to `yes`. This overrides other NetBIOS related settings. |
Expand Down Expand Up @@ -182,7 +182,7 @@ samba_shares:
write_list: +pirates
```

Guests have no access to this share, registered users can read. You can further tweak access control. Read access can be extended to guests (add `public: yes`) or restricted to specified users or groups (add `valid_users: +pirates`). Write access can be restricted to individual pirates (e.g. `write_list: jack`). Files added to the share will be added to the specified group and group write access will be granted by default.
Guests have no access to this share, registered users can read. You can further tweak access control. Read access can be extended to guests (add `public: true`) or restricted to specified users or groups (add `valid_users: +pirates`). Write access can be restricted to individual pirates (e.g. `write_list: jack`). Files added to the share will be added to the specified group and group write access will be granted by default.

This is an example of configuring multiple vfs object modules to share a glusterfs volume. VFS object options are optional. The necessary VFS object modules must be present/installed outside this collection. In this case samba-glusterfs was installed on centos. See samba documentation for how to install or what the default VFS object modules are.

Expand All @@ -206,8 +206,8 @@ samba_shares:
- name: loglevel
value: 7
path: /
read_only: 'no'
guest_ok: 'yes'
read_only: false
guest_ok: true
write_list: tomcat
group: tomcat
```
Expand All @@ -229,7 +229,7 @@ A complete overview of share options follows below. Only `name` is required, the
| `name` (required) | - | The name of the share. |
| `owner` | `root` | Set the owner of the path |
| `path` | `/{{samba_shares_root}}/{{name}}` | The path to the share directory. |
| `public` | `no` | Controls read access for guest users |
| `public` | `false` | Controls read access for guest users |
| `read_only` | - | If this parameter is yes, then users of a service may not create or modify files in the service's directory. |
| `setype` | - | The SELinux type of the share directory |
| `user` | - | The user files in the share will be added to. (force user) |
Expand Down
24 changes: 12 additions & 12 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,39 +46,39 @@
valid_users: usr1
write_list: usr1
group: usr1
browseable: 'no'
browseable: false
- name: protectedshare
public: 'yes'
public: true
comment: 'Public, but only writeable by usr2'
write_list: usr2
user: usr2
group: users
browseable: 'yes'
browseable: true
include_file: protectedshare-include.conf
- name: publicshare
comment: 'Public share, writeable by all members of group ‘users’'
public: 'yes'
public: true
write_list: +users
group: users
browseable: 'yes'
browseable: true
- name: guestshare
comment: 'Share accessible for guests'
guest_ok: 'yes'
writeable: 'yes'
browseable: 'yes'
guest_ok: true
writeable: true
browseable: true
- name: TimeMachine
comment: 'Share useable as a TimeMachine backup target on MacOS'
vfs_objects:
- name: fruit
options:
- name: time machine
value: 'yes'
value: true
- name: streams_xattr
path: /srv/timemachine
write_list: timemachine
owner: timemachine
group: timemachine
public: 'no'
guest_ok: 'no'
browseable: 'no'
public: false
guest_ok: false
browseable: false
create_mask: '0600'
10 changes: 5 additions & 5 deletions roles/server/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ samba_manage_directories: true
samba_shares: []
samba_users: []

samba_enable_netbios: 'yes'
samba_wins_support: 'yes'
samba_local_master: 'yes'
samba_domain_master: 'yes'
samba_preferred_master: 'yes'
samba_enable_netbios: true
samba_wins_support: true
samba_local_master: true
samba_domain_master: true
samba_preferred_master: true
samba_mitigate_cve_2017_7494: true
34 changes: 17 additions & 17 deletions roles/server/templates/smb.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
{% if not samba_enable_netbios | bool %}
disable netbios = yes
{% endif %}
wins support = {{ samba_wins_support | ternary('yes', 'no') }}
local master = {{ samba_local_master | ternary('yes', 'no') }}
domain master = {{ samba_domain_master | ternary('yes', 'no') }}
preferred master = {{ samba_preferred_master | ternary('yes', 'no') }}
wins support = {{ samba_wins_support | bool | ternary('yes', 'no') }}
local master = {{ samba_local_master | bool | ternary('yes', 'no') }}
domain master = {{ samba_domain_master | bool | ternary('yes', 'no') }}
preferred master = {{ samba_preferred_master | bool | ternary('yes', 'no') }}

{% if samba_load_printers %}
load printers = yes
Expand Down Expand Up @@ -112,7 +112,7 @@
{% endif %}
{% endfor %}{% endif %}
path = {{ share.path | default([samba_shares_root,share.name] | join('/')) }}
public = {{ share.public | default('no') }}
public = {{ share.public | default('no') | bool | ternary('yes', 'no') }}
{% if share.valid_users is defined and share.valid_users %}
valid users= {{ share.valid_users }}
{% endif %}
Expand All @@ -125,23 +125,23 @@
{% if share.user is defined and share.user %}
force user = {{ share.user }}
{% endif %}
{% if share.guest_ok is defined and share.guest_ok %}
guest ok = {{ share.guest_ok }}
{% if share.guest_ok is defined %}
guest ok = {{ share.guest_ok | bool | ternary('yes', 'no') }}
{% endif %}
{% if share.browsable is defined and share.browsable %}
browsable = {{ share.browsable | ternary('yes', 'no') }}
{% if share.browsable is defined %}
browsable = {{ share.browsable | bool | ternary('yes', 'no') }}
{% endif %}
{% if share.browseable is defined and share.browseable %}
browseable = {{ share.browseable | ternary('yes', 'no') }}
{% if share.browseable is defined %}
browseable = {{ share.browseable | bool | ternary('yes', 'no') }}
{% endif %}
{% if share.writable is defined and share.writable %}
writable = {{ share.writable | ternary('yes', 'no') }}
{% if share.writable is defined %}
writable = {{ share.writable | bool | ternary('yes', 'no') }}
{% endif %}
{% if share.writeable is defined and share.writeable %}
writeable = {{ share.writeable | ternary('yes', 'no') }}
{% if share.writeable is defined %}
writeable = {{ share.writeable | bool | ternary('yes', 'no') }}
{% endif %}
{% if share.read_only is defined and share.read_only %}
read only = {{ share.read_only | ternary('yes', 'no') }}
{% if share.read_only is defined %}
read only = {{ share.read_only | bool | ternary('yes', 'no') }}
{% endif %}
create mode = {{ share.create_mode | default('0664') }}
force create mode = {{ share.force_create_mode | default('0664') }}
Expand Down

0 comments on commit 9a7e7d1

Please sign in to comment.