Forge Home

samba

Samba is a module for samba service config and package version managing.

1,204 downloads

1,110 latest version

2.8 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.2.0 (latest)
  • 0.1.0
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

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'arrnorets-samba', '0.2.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add arrnorets-samba
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install arrnorets-samba --version 0.2.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

arrnorets/samba — version 0.2.0 Aug 6th 2021

Table of contents

  1. Common purpose
  2. Compatibility
  3. Installation
  4. Config example in Hiera and result files

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.