Skip to content

Commit

Permalink
playbook shared_directories: allow configuring writeability of shared…
Browse files Browse the repository at this point in the history
… dir
  • Loading branch information
dometto committed Sep 19, 2024
1 parent fcaf4fc commit ba2030e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions molecule/playbook-shared_directories/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ provisioner:
parameters:
paths: /shared, /home/testuser/shared,/scratch
group_name: testgroup
group_writable: 'false'
2 changes: 1 addition & 1 deletion molecule/playbook-shared_directories/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
- name: Assert shared folder has correct mode and ownership
ansible.builtin.assert:
that:
- "'drwxrws' in item.stdout"
- "'drwxr s' in item.stdout"
- "'root testgroup' in item.stdout"
with_items:
- "{{ list_dir1 }}"
Expand Down
3 changes: 2 additions & 1 deletion playbooks/shared_directories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
gather_facts: true
vars:
_group_name: "{{ group_name | default('shared') }}"
_group_writable: "{{ group_writable | default('true', true) | bool | ternary('7','5') }}"
roles:
- role: default_group
vars:
Expand All @@ -15,7 +16,7 @@
path: "{{ item | trim }}"
owner: "root"
group: "{{ _group_name }}"
mode: "02770"
mode: "027{{ _group_writable }}0"
state: directory
recurse: true
with_items: "{{ paths.split(',') }}"

0 comments on commit ba2030e

Please sign in to comment.