Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group possible backend share configurations under same environment #117

Merged
merged 8 commits into from
Aug 28, 2024
2 changes: 0 additions & 2 deletions playbooks/ansible/roles/samba.setup/tasks/cephfs/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
- name: Prepare CephFS VFS support
when: config.be.variant == 'vfs'
block:
- name: Process OS specific tasks
include_tasks: "{{ include_file }}"
Expand Down Expand Up @@ -28,7 +27,6 @@
state: present

- name: Temporarily allow cap_dac_override for smbd from SELinux
when: config.be.variant == 'default'
block:
- name: Remove any existing policy package
command: semodule -r smbd_dac_override
Expand Down
1 change: 0 additions & 1 deletion playbooks/ansible/roles/samba.setup/tasks/gpfs/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
- name: Run smbd unconfined
when: config.be.variant == 'vfs'
block:
- name: Configure SElinux context for smbd
sefcontext:
Expand Down
1 change: 0 additions & 1 deletion playbooks/ansible/roles/sit.cephfs/tasks/repo/centos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
when: inventory_hostname in groups['cluster']
block:
- name: Install VFS module
when: config.be.variant == 'vfs'
yum:
name: samba-vfs-cephfs
state: present
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
resources:
{%- for share in samba_shares +%}
{%- for method in config.be.methods +%}
{%- set provider = 'samba-vfs' +%}
- resource_type: ceph.smb.share
cluster_id: site
share_id: {{ share.name }}
intent: present
name: {{ share.name }}-{{ config.be.name }}-{{ config.be.variant }}
name: {{ share.name }}-{{ config.be.name }}-{{ config.be.variant }}-{{ method }}
cephfs:
volume: sit_fs
path: /
subvolume: {{ share.name }}
provider: {{ provider }}
{%- endfor +%}
{%- endfor +%}
19 changes: 11 additions & 8 deletions playbooks/ansible/roles/sit.cephfs/templates/smb_share.conf.j2
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
[{{ name }}-{{ config.be.name }}-{{ config.be.variant }}]
comment = Volume '{{ name }}' from {{ config.be.name }}({{ config.be.variant }})
{%- for method in config.be.methods +%}
[{{ volume.name }}-{{ config.be.name }}-{{ config.be.variant }}-{{ method }}]
comment = Volume '{{ volume.name }}' from {{ config.be.name }}({{ config.be.variant }} {{ method }})
vfs objects = acl_xattr ceph_snapshots
{%- if config.be.variant == 'vfs' %} ceph
ceph:config_file = /etc/ceph/sit.ceph.conf
ceph:user_id = sit
{%- if method != 'kclient' %}
{%- set vfs = 'ceph' %} {{ vfs }}
anoopcs9 marked this conversation as resolved.
Show resolved Hide resolved
{{ vfs }}:config_file = /etc/ceph/sit.ceph.conf
{{ vfs }}:user_id = sit
path = {{ subvol }}
{%- else +%}
{%- else +%}
path = {{ path }}
{%- endif +%}
{%- endif +%}
browseable = yes
read only = no
{%- for option, value in volume.samba.options.items() | default([]) +%}
{%- for option, value in volume.samba.options.items() | default([]) +%}
{{ option }} = {{ value }}
{%- endfor +%}
{%- endfor +%}
6 changes: 3 additions & 3 deletions playbooks/ansible/roles/sit.gpfs/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,6 @@
- name: Configure shares
command: >-
/usr/lpp/mmfs/bin/mmsmb export add
{{ item.name }}-{{ config.be.name }}-{{ config.be.variant }}
/gpfs/sit_fs/{{ item.name }}
loop: "{{ samba_shares }}"
{{ item[0].name }}-{{ config.be.name }}-{{ config.be.variant }}-{{ item[1] }}
/gpfs/sit_fs/{{ item[0].name }}
loop: "{{ samba_shares | product(config.be.methods) | list }}"
10 changes: 6 additions & 4 deletions playbooks/ansible/roles/sit.gpfs/templates/smb_share.conf.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[{{ name }}-{{ config.be.name }}-{{ config.be.variant }}]
comment = Volume '{{ name }}' from {{ config.be.name }}({{ config.be.variant }})
vfs objects = acl_xattr {%- if config.be.variant == 'vfs' %} gpfs{% endif +%}
{%- for method in config.be.methods +%}
[{{ volume.name }}-{{ config.be.name }}-{{ config.be.variant }}-{{ method }}]
comment = Volume '{{ volume.name }}' from {{ config.be.name }}({{ config.be.variant }} {{ method }})
vfs objects = acl_xattr {%- if method != 'kclient' %} gpfs{% endif +%}
path = {{ path }}
read only = no
{%- for option, value in volume.samba.options.items() | default([]) +%}
{%- for option, value in volume.samba.options.items() | default([]) +%}
{{ option }} = {{ value }}
{%- endfor +%}
{%- endfor +%}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
src: test-info.yml.j2
dest: /root/test-info.yml
vars:
public_interfaces: "{{ (config.be.variant == 'mgr') | ternary(node_network_public_interfaces, ctdb_network_public_interfaces) }}"

Check warning on line 33 in playbooks/ansible/roles/test.sit-test-cases/tasks/prepare/main.yml

View workflow job for this annotation

GitHub Actions / yamllint

33:121 [line-length] line too long (133 > 120 characters)
sharenames: "{{ samba_shares | map(attribute='name') | list }}"

- name: Create a symlink for test-info.yml file
file:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,20 @@ users:
backend: {{ config.be.name }}

shares:
{%- for share in sharenames +%}
{{ share }}-{{ config.be.name }}-{{ config.be.variant }}:
{%- for share in samba_shares +%}
{%- if config.be.methods is defined +%}
{%- for method in config.be.methods +%}
{{ share.name }}-{{ config.be.name }}-{{ config.be.variant}}-{{ method }}:
backend:
name: {{ config.be.name }}
variant: {{ config.be.variant}}
path: {{ config.paths.mount }}/backends/{{ share }}
path: {{ config.paths.mount }}/backends/{{ share.name }}
{%- endfor +%}
{%- else +%}
{{ share.name }}-{{ config.be.name }}-{{ config.be.variant }}:
backend:
name: {{ config.be.name }}
variant: {{ config.be.variant}}
path: {{ config.paths.mount }}/backends/{{ share.name }}
{%- endif +%}
{%- endfor +%}
7 changes: 7 additions & 0 deletions playbooks/roles/local.defaults/templates/config.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ config:
be:
name: "{{ be }}"
variant: "{{ variant }}"
{%- if settings.environments[be].data.methods is defined +%}
{%- set methods = settings.environments[be].data.methods +%}
{%- if variant != 'default' +%}
{%- set methods = ['vfs'] +%}
{%- endif +%}
methods: {{ methods }}
{%- endif +%}

{%- if settings.environments[be].domain is defined +%}
domain: "{{ settings.environments[be].domain }}"
Expand Down
2 changes: 2 additions & 0 deletions playbooks/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ environments:
data:
branch: main
ctdb_mutex: rados
methods: ['klcient', 'vfs']

nodes:
setup:
Expand Down Expand Up @@ -409,6 +410,7 @@ environments:
# file inside the zip. It must have a capturing group to extract the
# version number.
pattern: "Storage_Scale_Developer-([0-9.]+)-x86_64-Linux-install"
methods: ['kclient', 'vfs']

nodes:
setup:
Expand Down
Loading