From 801f8ed3fa845898a7473906b6fbe366b838696a Mon Sep 17 00:00:00 2001 From: Andrew Radke Date: Mon, 14 Aug 2023 12:47:55 +1000 Subject: [PATCH 01/11] Add global samba_manage_directories and individual share manage_directory options --- roles/server/defaults/main.yml | 1 + roles/server/tasks/main.yml | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/server/defaults/main.yml b/roles/server/defaults/main.yml index 0dd0e91..48e398d 100644 --- a/roles/server/defaults/main.yml +++ b/roles/server/defaults/main.yml @@ -14,6 +14,7 @@ samba_cups_server: 'localhost:631' samba_load_homes: false samba_create_varwww_symlinks: false samba_shares_root: '/srv/shares' +samba_manage_directories: true samba_shares: [] samba_users: [] diff --git a/roles/server/tasks/main.yml b/roles/server/tasks/main.yml index 7332bdd..b1e4160 100644 --- a/roles/server/tasks/main.yml +++ b/roles/server/tasks/main.yml @@ -57,7 +57,8 @@ owner: root group: root mode: '0755' - when: samba_shares is defined and samba_shares | length > 0 + when: (samba_shares is defined and samba_shares | length > 0) and + ( samba_manage_directories is defined and samba_manage_directories ) tags: samba - name: Create share directories @@ -69,7 +70,9 @@ mode: "{{ item.directory_mode | default('0775') }}" setype: "{{ item.setype | default('samba_share_t') }}" loop: "{{ samba_shares }}" - when: samba_shares is defined and samba_shares | length > 0 + when: ( samba_shares is defined and samba_shares | length > 0 ) and + ( samba_manage_directories is defined and samba_manage_directories ) and + ( item.manage_directory is undefined or item.manage_directory != false ) tags: samba - name: Ensure webserver document root exists From ba665677e418f30ffd8d9b11bfdfe9da735cf92c Mon Sep 17 00:00:00 2001 From: Andrew Radke Date: Thu, 17 Aug 2023 12:16:32 +1000 Subject: [PATCH 02/11] Add entry to README.md for samba_manage_directories and remove inidividual share manage_directory option --- README.md | 1 + roles/server/tasks/main.yml | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4004c26..c7725cf 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,7 @@ See [Ansible using collections](https://docs.ansible.com/ansible/latest/user_gui | `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_manage_directories` | `true` | Create the directories, and manage the permissions/ownership, of the shares root and the shares under it. | | `samba_shares` | `[]` | List of dicts containing share definitions. See below for details. | | `samba_username_map` | `[]` | Makes username map configurable. | | `samba_users` | `[]` | List of dicts defining users that can access shares. | diff --git a/roles/server/tasks/main.yml b/roles/server/tasks/main.yml index b1e4160..d886b51 100644 --- a/roles/server/tasks/main.yml +++ b/roles/server/tasks/main.yml @@ -71,8 +71,7 @@ setype: "{{ item.setype | default('samba_share_t') }}" loop: "{{ samba_shares }}" when: ( samba_shares is defined and samba_shares | length > 0 ) and - ( samba_manage_directories is defined and samba_manage_directories ) and - ( item.manage_directory is undefined or item.manage_directory != false ) + ( samba_manage_directories is defined and samba_manage_directories ) tags: samba - name: Ensure webserver document root exists From 50a0fe4f26e90b46fa0e9d041c43480c1407abdf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 24 Aug 2023 15:49:03 +0000 Subject: [PATCH 03/11] Update actions/checkout action to v3.6.0 --- .github/workflows/labels.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index b1f5c67..cd4e09a 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v3.5.3 + uses: actions/checkout@v3.6.0 - name: Label actions uses: micnncim/action-label-syncer@v1.3.0 env: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bd04a34..47075d0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v3.5.3 + uses: actions/checkout@v3.6.0 with: ref: ${{ github.head_ref }} - name: Get the version name from the tags diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 73f7e13..eb1f9ec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: scenario: ${{ steps.filter.outputs.changes }} steps: - name: Checkout - uses: actions/checkout@v3.5.3 + uses: actions/checkout@v3.6.0 - name: Detect changes uses: dorny/paths-filter@v2.11.1 id: filter @@ -51,7 +51,7 @@ jobs: scenario: ${{ fromJSON(needs.changes.outputs.scenario) }} steps: - name: Checkout - uses: actions/checkout@v3.5.3 + uses: actions/checkout@v3.6.0 with: path: ansible_collections/vladgh/samba - name: Molecule test From 1dc50d2e6f6037cb7da17efd94ec76e5b06a6ba9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 14:01:21 +0000 Subject: [PATCH 04/11] Update actions/checkout action to v4 --- .github/workflows/labels.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index cd4e09a..92d4867 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v3.6.0 + uses: actions/checkout@v4.0.0 - name: Label actions uses: micnncim/action-label-syncer@v1.3.0 env: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 47075d0..29a1bac 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v3.6.0 + uses: actions/checkout@v4.0.0 with: ref: ${{ github.head_ref }} - name: Get the version name from the tags diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb1f9ec..c2d863e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: scenario: ${{ steps.filter.outputs.changes }} steps: - name: Checkout - uses: actions/checkout@v3.6.0 + uses: actions/checkout@v4.0.0 - name: Detect changes uses: dorny/paths-filter@v2.11.1 id: filter @@ -51,7 +51,7 @@ jobs: scenario: ${{ fromJSON(needs.changes.outputs.scenario) }} steps: - name: Checkout - uses: actions/checkout@v3.6.0 + uses: actions/checkout@v4.0.0 with: path: ansible_collections/vladgh/samba - name: Molecule test From 275b1b633fb4f059c4cbf99472096e137c2cf85b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 16 Sep 2023 02:21:40 +0000 Subject: [PATCH 05/11] Update gofrolist/molecule-action action to v2.5.0 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2d863e..bdaf790 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,7 +55,7 @@ jobs: with: path: ansible_collections/vladgh/samba - name: Molecule test - uses: gofrolist/molecule-action@v2.4.1 + uses: gofrolist/molecule-action@v2.5.0 with: molecule_command: test molecule_options: --debug From 6dbc70675f1877b16632d3c2b26612a7b19d7332 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 22 Sep 2023 19:52:18 +0000 Subject: [PATCH 06/11] Update actions/checkout action to v4.1.0 --- .github/workflows/labels.yml | 2 +- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index 92d4867..ce58451 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v4.0.0 + uses: actions/checkout@v4.1.0 - name: Label actions uses: micnncim/action-label-syncer@v1.3.0 env: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 29a1bac..5ff83f2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout - uses: actions/checkout@v4.0.0 + uses: actions/checkout@v4.1.0 with: ref: ${{ github.head_ref }} - name: Get the version name from the tags diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bdaf790..d0bbbb8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: scenario: ${{ steps.filter.outputs.changes }} steps: - name: Checkout - uses: actions/checkout@v4.0.0 + uses: actions/checkout@v4.1.0 - name: Detect changes uses: dorny/paths-filter@v2.11.1 id: filter @@ -51,7 +51,7 @@ jobs: scenario: ${{ fromJSON(needs.changes.outputs.scenario) }} steps: - name: Checkout - uses: actions/checkout@v4.0.0 + uses: actions/checkout@v4.1.0 with: path: ansible_collections/vladgh/samba - name: Molecule test From c93ed11461734d3f9084c5148b60e447dadced2b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 23 Sep 2023 01:06:43 +0000 Subject: [PATCH 07/11] Update gofrolist/molecule-action action to v2.5.1 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d0bbbb8..1a918c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,7 +55,7 @@ jobs: with: path: ansible_collections/vladgh/samba - name: Molecule test - uses: gofrolist/molecule-action@v2.5.0 + uses: gofrolist/molecule-action@v2.5.1 with: molecule_command: test molecule_options: --debug From 02c100d27e348253cb03b7f51426b6adb9b892a9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 30 Sep 2023 01:07:32 +0000 Subject: [PATCH 08/11] Update gofrolist/molecule-action action to v2.5.2 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1a918c2..6d88251 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,7 +55,7 @@ jobs: with: path: ansible_collections/vladgh/samba - name: Molecule test - uses: gofrolist/molecule-action@v2.5.1 + uses: gofrolist/molecule-action@v2.5.2 with: molecule_command: test molecule_options: --debug From 093e9fa185a226ab265484c3829fe975004c20c2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 6 Oct 2023 18:02:30 +0000 Subject: [PATCH 09/11] Update stefanzweifel/git-auto-commit-action action to v5 --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5ff83f2..ea90e38 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,7 +19,7 @@ jobs: run: | sed -Ei "s/^version: .*/version: ${{ env.RELEASE_VERSION }}/" galaxy.yml - name: Commit galaxy.yml - uses: stefanzweifel/git-auto-commit-action@v4.16.0 + uses: stefanzweifel/git-auto-commit-action@v5.0.0 with: branch: main commit_message: "Update galaxy.yml for ${{ env.RELEASE_VERSION }}" From 94985d8abb120e566c923d1da19e8ac3129f769a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 7 Oct 2023 00:46:28 +0000 Subject: [PATCH 10/11] Update gofrolist/molecule-action action to v2.5.3 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6d88251..9b9fdc1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,7 +55,7 @@ jobs: with: path: ansible_collections/vladgh/samba - name: Molecule test - uses: gofrolist/molecule-action@v2.5.2 + uses: gofrolist/molecule-action@v2.5.3 with: molecule_command: test molecule_options: --debug From 679968d01b3f635991d4947eaa5205b31e54b89f Mon Sep 17 00:00:00 2001 From: Vlad Date: Sun, 8 Oct 2023 12:41:32 -0500 Subject: [PATCH 11/11] Update README with variables information --- README.md | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c7725cf..a9aba9f 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ More info: ## Using this collection -### Installing the Collection from Ansible Galaxy +### Install collection Install it with the Ansible Galaxy CLI: @@ -45,7 +45,16 @@ collections: - name: vladgh.samba ``` -Using the GitHub repository and specific branch or release: +Optionally, You can specify a version number: + +```yaml +--- +collections: + - name: vladgh.samba + version: ">=3.1.1" +``` + +You can also refer to a branch or to a git commit-ish object (commit, tag, branch or release) ```yaml collections: @@ -54,11 +63,19 @@ collections: type: git ``` -### Import Roles +For more information, see [Ansible using collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) + +### Load role + +After the collection is installed you can include the `server` role. +You can define variables in a variety of places, such as in inventory, in playbooks, in reusable files, in roles, and at the command line. Ansible loads every possible variable it finds, then chooses the variable to apply based on [variable precedence rules](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#ansible-variable-precedence). +A complete overview of server role variables follows below. + +For more information, see [Using variables](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#where-to-set-variables). ```yaml --- -- name: Common +- name: Samba Server hosts: all become: true tasks: @@ -67,7 +84,9 @@ collections: name: vladgh.samba.server ``` -### Import Playbooks +### Import playbook + +Alternatively, you can directly import the existing playbook: ```yaml --- @@ -75,8 +94,6 @@ collections: ansible.builtin.import_playbook: vladgh.samba.server ``` -See [Ansible using collections](https://docs.ansible.com/ansible/latest/user_guide/collections_using.html) for more details. - ## Server Role Variables | Variable | Default | Comments |