121 lines
3.9 KiB
YAML
121 lines
3.9 KiB
YAML
---
|
|
# SAMBA and ibays
|
|
|
|
- name: Installing SAMBA and ibays packages
|
|
yum:
|
|
name: "{{ item }}"
|
|
state: present
|
|
with_items:
|
|
- nethserver-ibays
|
|
- nethserver-samba
|
|
- nethserver-samba-audit
|
|
|
|
# Mitigating bug for upgrade on Badlocks SAMBA bug
|
|
- name: Mitigating bad upgrade for Badlocks
|
|
shell: yum -y downgrade samba* tdb-tools libtdb libtevent libtalloc pytalloc
|
|
tags:
|
|
- badlocks
|
|
- centos_bug
|
|
|
|
# Locking SAMBA version to be sure to fix badblocks update
|
|
- name: Installing versionlock yum-plugin
|
|
yum:
|
|
name: yum-plugin-versionlock
|
|
state: present
|
|
|
|
- name: Checking if already locked
|
|
shell: yum versionlock list | grep -q samba && echo 'Locked' || true
|
|
register: chk_locked_samba
|
|
changed_when: "'Locked' not in chk_locked_samba.stdout"
|
|
|
|
- name: Locking samba version
|
|
shell: yum versionlock add samba
|
|
when: chk_locked_samba|changed
|
|
|
|
# SAMBA
|
|
|
|
- name: Checking SMB configuration
|
|
shell: /sbin/e-smith/db configuration printprop smb RoamingProfiles
|
|
register: chk_smb
|
|
changed_when: "'RoamingProfiles=yes' not in chk_smb.stdout"
|
|
ignore_errors: true
|
|
|
|
- name: "Enabling unix extensions on SAMBA"
|
|
replace:
|
|
dest: /etc/e-smith/templates/etc/samba/smb.conf/10global
|
|
regexp: '^unix extensions = no$'
|
|
replace: 'unix extensions = yes'
|
|
|
|
- name: Configuring SMB
|
|
shell: /sbin/e-smith/db configuration setprop smb RoamingProfiles yes ServerRole PDC Workgroup "{{ ansible_local.domain.domainshort }}" status enabled
|
|
when: chk_smb|changed
|
|
|
|
- name: Activating SMB
|
|
shell: /sbin/e-smith/signal-event nethserver-samba-save
|
|
when: chk_smb|changed
|
|
|
|
# ibays
|
|
|
|
- name: Enabling SMB services restart when managing ibays
|
|
file:
|
|
src: reload
|
|
dest: "{{ item }}/smb"
|
|
state: link
|
|
force: yes
|
|
with_items:
|
|
- /etc/e-smith/events/ibay-delete/services2adjust
|
|
- /etc/e-smith/events/ibay-create/services2adjust
|
|
- /etc/e-smith/events/ibay-modify/services2adjust
|
|
|
|
- name: Checking for shared ibay
|
|
shell: /sbin/e-smith/db accounts show shared
|
|
ignore_errors: true
|
|
register: chk_shared
|
|
|
|
- name: Copying default templates for shared template type
|
|
shell: cp -r /etc/e-smith/templates/etc/samba/smb.conf/ibay-default /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared
|
|
when: force_ibay_shared|bool or chk_shared|failed
|
|
|
|
- name: Configuring ibay-shared template structure (directory mask)
|
|
lineinfile:
|
|
dest: /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared/20profile_default
|
|
line: 'directory mask = 0775'
|
|
insertafter: '^create mask'
|
|
state: present
|
|
when: force_ibay_shared|bool or chk_shared|failed
|
|
|
|
- name: Configuring force create mode
|
|
lineinfile:
|
|
dest: /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared/20profile_default
|
|
line: 'force create mode = 0664'
|
|
insertafter: '^directory mask'
|
|
state: present
|
|
when: force_ibay_shared|bool or chk_shared|failed
|
|
|
|
- name: Configuring force directory mode
|
|
lineinfile:
|
|
dest: /etc/e-smith/templates/etc/samba/smb.conf/ibay-shared/20profile_default
|
|
line: 'force directory mode = 0775'
|
|
insertafter: '^force create mode'
|
|
state: present
|
|
when: force_ibay_shared|bool or chk_shared|failed
|
|
|
|
- name: Configuring shared ibay
|
|
shell: /sbin/e-smith/db accounts set shared ibay AclRead domusers,domadmins AclWrite domusers,domadmins Description "Cartella condivisa" GroupAccess rw HttpStatus disabled OtherAccess r OwningGroup locals SmbAuditStatus enabled SmbGuestAccessType none SmbRecycleBinStatus enabled SmbRecycleBinVersionsStatus enabled SmbStatus enabled
|
|
when: chk_shared|failed
|
|
|
|
- name: Activating shared ibay
|
|
shell: /sbin/e-smith/signal-event ibay-create shared
|
|
become: yes
|
|
when: chk_shared|failed
|
|
|
|
- name: Changing ibay profile for shared
|
|
shell: /sbin/e-smith/db accounts setprop shared SmbProfileType shared
|
|
become: yes
|
|
when: force_ibay_shared|bool or chk_shared|failed
|
|
|
|
- name: Forcing regeneration of smb.conf
|
|
shell: /sbin/e-smith/signal-event nethserver-samba-update
|
|
become: yes
|
|
when: force_ibay_shared|bool or chk_shared|failed
|