Files
dsfin-ansible/roles/role-samba4-ad-member/tasks/main.yml
Michael Pellegrino ee93d4b975 Update ad role tasks
2021-09-11 14:35:58 +00:00

93 lines
2.7 KiB
YAML

---
# Title: ansible-role-samba4-ad-member
#
# Author: Bitfinity-NL
# File: tasks/ubt-1804-amd64.yml
#
# Description:
# Samba is the standard Windows interoperability
# suite of programs for Linux and Unix.
#
- name: update hosts file
become: true
blockinfile:
dest: /etc/hosts
content: "{{ lookup('template', '{{ role_path }}/templates/hosts.j2') }}"
state: present
tags: update_hosts
- name: set hostname
become: true
hostname:
name: '{{ inventory_hostname }}'
tags: set_hostname
- name: "IFor OS: Ubuntu 20.04LTS, Arch: amd64"
import_tasks: ubt-2004-amd64.yml
when:
- ansible_distribution_version == "20.04"
- ansible_architecture == "x86_64"
- name: "For OS: Ubuntu 16.04LTS, Arch: amd64"
import_tasks: ubt-1604-amd64.yml
when:
- ansible_distribution_version == "16.04"
- ansible_architecture == "x86_64"
- name: "IFor OS: Ubuntu 18.04LTS, Arch: amd64"
import_tasks: ubt-1804-amd64.yml
when:
- ansible_distribution_version == "18.04"
- ansible_architecture == "x86_64"
- name: "Check that {{ public_share_path }} exist"
stat:
path: "{{ public_share_path }}"
register: public_dir_exists
- name: "Create {{ public_share_path }} directory"
become: yes
file:
state: directory
path: "{{ public_share_path }}"
owner: nobody
group: nogroup
mode: 0755
recurse: yes
when: public_dir_exists.stat.exists == False
- name: "Check that {{ private_share_path }} exist"
stat:
path: "{{ private_share_path }}"
register: private_dir_exists
- name: "Create {{ private_share_path }} directory"
become: yes
file:
state: directory
path: "{{ private_share_path }}"
owner: root
group: "{{ samba_group_name }}"
mode: 1770
when: private_dir_exists.stat.exists == False
- name: set acl's on public share
ansible.posix.acl:
path: "{{ public_share_path }}"
entry: "{{ item.entry }}"
state: present
with_items:
- { entry: "user::rwx" }
- { entry: "user:nobody:rwx" }
- { entry: "group::r-x" }
- { entry: "group:domain users:rwx" }
- { entry: "mask::rwx" }
- { entry: "other::r-x" }
- { entry: "default:user::rwx" }
- { entry: "default:user:administrator:rwx" }
- { entry: "default:group::r-x" }
- { entry: "default:group:domain users:rwx" }
- { entry: "default:group:nogroup:r-x" }
- { entry: "default:mask::rwx" }
- { entry: "default:other::r-x" }
- name: Add DNS record for server
command: /usr/bin/samba-tool dns add {{smb_dns_servers}} {{smb_realm}} {{inventory_hostname}} A {{ansible_host}} --username="{{smb_username}}" --password="{{smb_password}}"