diff --git a/CHANGELOG.md b/CHANGELOG.md index 6684aab..5d0082d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ This file contains al notable changes to the bertvv.samba Ansible role. This file adheres to the guidelines of [http://keepachangelog.com/](http://keepachangelog.com/). Versioning follows [Semantic Versioning](http://semver.org/). "GH-X" refers to the X'th issue on the Github project. +## 2.1.0 - 2016-05-12 + +### Added + +- (GH-7) Support for Debian/Ubuntu (credit: [Ian Young](https://github.com/iangreenleaf)) and Fedora. +- Vagrant test environment for all supported platforms + +### Changed + +- Moved test code to a separate branch +- (GH-8) Fixed deprecation warnings in Ansible 2.0 (partial credit: [Ian Young](https://github.com/iangreenleaf)) +- Use the generic `package:` module introduced in Ansible 2.0. + +### Removed + +- The `version:` field in `meta/main.yml` was removed because it is no longer accepted in Ansible 2.0. Unfortunately, this change breaks compatibility with `librarian-ansible`. For more info on this issue, see [ansible/ansible#](https://github.com/ansible/ansible/issues/13496). + ## 2.0.2 - 2015-12-01 ### Changed @@ -18,7 +35,7 @@ This file adheres to the guidelines of [http://keepachangelog.com/](http://keepa ### Changed -- The variable type of `samba_create_varwww_symlinks` is now boolean instead of string (GH-1) +- (GH-1) The variable type of `samba_create_varwww_symlinks` is now boolean instead of string - The variable `samba_netbios_name` is no longer required and defaults to `ansible_hostname`. ## 2.0.0 - 2015-11-05 @@ -27,8 +44,8 @@ Bugfix release with changes that are not backwards compatible ### Changed -- The variable type of `samba_load_*` is now boolean instead of string, which makes more sense. However, this change is **not backwards compatible**. (GH-1) -- Restart WinBind when changing the configuration (GH-2) +- (GH-1) The variable type of `samba_load_*` is now boolean instead of string, which makes more sense. However, this change is **not backwards compatible**. +- (GH-2) Restart WinBind when changing the configuration - Updated the base box for the test environment to CentOS 7.1 ([bertvv/centos71](https://atlas.hashicorp.com/bertvv/boxes/centos71/)) - Cleaned up indentation and spaces in the configuration file template diff --git a/README.md b/README.md index 28f552a..3599e31 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,26 @@ # Ansible role `bertvv.samba` -An Ansible role for setting up Samba as a file server on CentOS/RHEL 7. Specifically, the responsibilities of this role are to: +An Ansible role for setting up Samba as a file server on RedHat- or Debian-based linux distros. Specifically, the responsibilities of this role are to: - Install the necessary packages -- Configure SELinux settings +- Configure SELinux settings (when SELinux is active) - Create share directories -- Manage users and passwords +- Manage Samba users and passwords - Manage access to shares -Setting the firewall is not a concern of this role, so you should configure this using another role (e.g. [bertvv.el7](https://galaxy.ansible.com/list#/roles/2305)). +The following are not considered concerns of this role, and you should configure these using another role (e.g. [bertvv.el7](https://galaxy.ansible.com/bertvv/el7/): + +- Managing firewall settings. +- Creating system users. Samba users should already exist as system users. + +**If you like/use this role, please consider giving it a star! Thanks!** ## Requirements -- SELinux is expected to be running -- Samba users should already exist as system users. You can take a look at role [bertvv.el7](https://galaxy.ansible.com/list#/roles/2305) that does all this and more. +No specific requirements ## Role Variables -Variables are not required, unless specified. - | Variable | Default | Comments | | :--- | :--- | :--- | | `samba_create_varwww_symlinks` | false | When true, symlinks are created in `/var/www/html` to the shares. | @@ -31,9 +33,9 @@ Variables are not required, unless specified. | `samba_passdb_backend` | `tdbsam` | Password database backend. | | `samba_security` | `user` | Samba security setting | | `samba_server_string` | `fileserver %m` | Comment string for the server. | -| `samba_shares` | - | List of dicts containing share definitions. See below for details. | +| `samba_shares` | [] | List of dicts containing share definitions. See below for details. | | `samba_shares_root` | `/srv/shares` | Directories for the shares are created under this directory. | -| `samba_users` | - | List of dicts defining users that can access shares. | +| `samba_users` | [] | List of dicts defining users that can access shares. | | `samba_workgroup` | `WORKGROUP` | Name of the server workgroup. | ### Defining users @@ -52,7 +54,7 @@ samba_users: Unfortunately, passwords have to be in plain text for now. -These users should already have an account on the host! Creating system users is not a concern of this role, so you should do this separately. A possibility is my role [bertvv.el7](https://galaxy.ansible.com/list#/roles/2305). An example: +These users should already have an account on the host! Creating system users is not a concern of this role, so you should do this separately. A possibility is my role [bertvv.el7](https://galaxy.ansible.com/bertvv/el7/). An example: ```Yaml el7_users: @@ -116,24 +118,30 @@ No dependencies. ## Example Playbook -See the [test playbook](tests/test.yml) +See the [test playbook](https://github.com/bertvv/ansible-role-samba/blob/tests/test.yml) ## Testing -The `tests` directory contains tests for this role in the form of a Vagrant environment. +### Setting up the test environment -- [`test.yml`](tests/test.yml) is a minimal playbook that only sets the NetBios name (the only required variable) -- [`test-full.yml`](tests/test-full.yml) is a more complete playbook that applies most features of this role. +Tests for this role are provided in the form of a Vagrant environment that is kept in a separate branch, `tests`. I use [git-worktree(1)](https://git-scm.com/docs/git-worktree) to include the test code into the working directory. Instructions for running the tests: -The directory `tests/roles/samba` is a symbolic link that should point to the root of this project in order to work. To create it, do +1. Fetch the tests branch: `git fetch origin tests` +2. Create a Git worktree for the test code: `git worktree add tests tests` (remark: this requires at least Git v2.5.0). This will create a directory `tests/`. +3. `cd tests/` +4. `vagrant up` will then create test VMs for all supported distros and apply a test playbook (`test.yml`) to each one. -```ShellSession -$ cd tests/ -$ mkdir roles -$ ln -frs ../../PROJECT_DIR roles/samba +### Issues + +On Ubuntu 16.04, setting up the VM may fail while running the test playbook because a background process is running the package manager. The output looks like: + +``` +... +TASK [samba : Install Samba packages] ****************************************** +failed: [samba-ubuntu1604] (item=[u'samba-common', u'samba', u'samba-client']) => {"cache_update_time": 0, "cache_updated": false, "failed": true, "item": ["samba-common", "samba", "samba-client"], "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\" install 'samba-common' 'samba' 'samba-client'' failed: E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)\nE: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?\n", "stderr": "E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)\nE: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?\n", "stdout": "", "stdout_lines": []} ``` -You may want to change the base box into one that you like. The current one is a base box I generated based on Box-Cutter's [CentOS Packer template](https://github.com/boxcutter/centos). It is shared on Atlas as [bertvv/centos71](https://atlas.hashicorp.com/bertvv/boxes/centos71/). +The workaround is waiting a bit and running `vagrant provision` again. ## See also @@ -153,4 +161,5 @@ Bert Van Vreckem (bert.vanvreckem@gmail.com) Contributions by: -- [@birgitcroux](https://github.com/birgitcroux) +- [Birgit Croux](https://github.com/birgitcroux) +- [Ian Young](https://github.com/iangreenleaf) diff --git a/meta/main.yml b/meta/main.yml index e5a8ee7..7bc4756 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,21 +1,21 @@ --- galaxy_info: author: Bert Van Vreckem - description: This role installs and configures Samba as a file server. - company: + description: This role installs and configures Samba as a file server on RedHat- or Debian-based Linux distros. license: BSD - min_ansible_version: 1.7 + min_ansible_version: 2.0 platforms: - - name: EL - versions: - - 7 - - name: Ubuntu - versions: - - all - - name: Debian - versions: - - all - categories: + - name: EL + versions: + - 6 + - 7 + - name: Ubuntu + versions: + - all + - name: Debian + versions: + - all + galaxy_tags: - system - networking dependencies: []