Version information
released Aug 6th 2021
This version is compatible with:
- Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
- Puppet >= 4.10.0 < 7.0.0
- , , ,
Start using this module
Add this module to your Puppetfile:
mod 'arrnorets-samba', '0.2.0'
Learn more about managing modules with a PuppetfileDocumentation
arrnorets/samba — version 0.2.0 Aug 6th 2021
Table of contents
1. Common purpose
Samba is a module for samba service config and package version manasging.
2. Compatibility
This module was tested on CentOS 7 and Gentoo Linux. However, it should work on newer versions of CentOS, Fedora and RHEL as well where Ansible 2.9 or newer is available.
3. Installation
mod 'samba',
:git => 'https://github.com/arrnorets/puppet-samba.git',
:ref => 'main'
4. Config example in Hiera and result files
This module follows the concept of so called "XaaH in Puppet". The principles are described here and here.
Here is the example of config in Hiera:
---
samba:
packages:
ansible: '2.9.10-1.el7'
samba: "present"
enable: true
users:
"<user>": "<password>"
config:
global:
workgroup: "MYGROUP"
server string: "Samba Server on mypc"
server role: "standalone server"
hosts allow: "192.168.1. 127."
log file: "/var/log/samba/log.%m"
max log size: 50
interfaces: "192.168.1.22/24"
asg_work:
path: "/home/<user>/work/syseng"
"write list": "<user>"
writable: "yes"
printable: "no"
create mask: "0644"
directory mask: "0755"
It will install ansible and samba packages, enable services smbd and nmbd and produce the folowing files:
- /etc/samba/smb.conf:
[global] workgroup = MYGROUP server string = Samba Server on mypc server role = standalone server hosts allow = 192.168.1. 127. log file = /var/log/samba/log.%m max log size = 50 interfaces = 192.168.1.22/24 [asg_work] path = /home/<user>/work/syseng write list = <user> writable = yes printable = no create mask = 0644 directory mask = 0755
- /opt/ansible4puppet-samba/conf/site.yml:
- name: Configure SAMBA users hosts: localhost strategy: linear vars: users_to_add: - name: "<user>" passwd: "<password>" users_to_remove: [] tasks: - name: Set samba users shell: | (echo '{{ item.passwd }}'; echo '{{ item.passwd }}') | smbpasswd -s -a "{{ item.name }}" with_items: - "{{ users_to_add }}" no_log: True delegate_to: localhost - name: Remove samba users shell: | smbpasswd -x "{{ item.name }}" with_items: - "{{ users_to_remove }}" no_log: True delegate_to: localhost
The Ansible site.yml will be executed by exec resource inside of the module once the file site.yml changes.