Skip to content

Commit

Permalink
Merge branch 'main' into selinux
Browse files Browse the repository at this point in the history
  • Loading branch information
vladgh authored Oct 8, 2023
2 parents 7e86e97 + d0b42e0 commit 37e30c5
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
uses: actions/checkout@v4.1.0
- name: Label actions
uses: micnncim/[email protected]
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
uses: actions/checkout@v4.1.0
with:
ref: ${{ github.head_ref }}
- name: Get the version name from the tags
Expand All @@ -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 }}"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
scenario: ${{ steps.filter.outputs.changes }}
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
uses: actions/checkout@v4.1.0
- name: Detect changes
uses: dorny/[email protected]
id: filter
Expand Down Expand Up @@ -51,11 +51,11 @@ jobs:
scenario: ${{ fromJSON(needs.changes.outputs.scenario) }}
steps:
- name: Checkout
uses: actions/checkout@v3.5.3
uses: actions/checkout@v4.1.0
with:
path: ansible_collections/vladgh/samba
- name: Molecule test
uses: gofrolist/molecule-action@v2.4.1
uses: gofrolist/molecule-action@v2.5.3
with:
molecule_command: test
molecule_options: --debug
Expand Down
32 changes: 25 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ More info: <https://access.redhat.com/security/cve/cve-2017-7494>

## Using this collection

### Installing the Collection from Ansible Galaxy
### Install collection

Install it with the Ansible Galaxy CLI:

Expand All @@ -44,7 +44,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:
Expand All @@ -53,11 +62,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:
Expand All @@ -66,16 +83,16 @@ collections:
name: vladgh.samba.server
```

### Import Playbooks
### Import playbook

Alternatively, you can directly import the existing playbook:

```yaml
---
- name: Samba Server
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 |
Expand Down Expand Up @@ -107,6 +124,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. |
Expand Down
1 change: 1 addition & 0 deletions roles/server/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: []

Expand Down
6 changes: 4 additions & 2 deletions roles/server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,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
Expand All @@ -53,7 +54,8 @@
mode: "{{ item.directory_mode | default('0775') }}"
setype: "{{ item.setype | default(omit) }}"
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 )
tags: samba

- name: Ensure webserver document root exists
Expand Down

0 comments on commit 37e30c5

Please sign in to comment.