55 lines
1.2 KiB
YAML
55 lines
1.2 KiB
YAML
|
|
|
|
- name: "set local variables from overrides and defaults"
|
|
set_fact:
|
|
samba_ad: "{{ (samba_ad_defaults | combine(samba_ad_override, recursive=True)) if samba_ad_override else samba_ad_defaults }}"
|
|
|
|
|
|
- name: disable systemd-resolve.conf
|
|
systemd:
|
|
name: systemd-resolve
|
|
enabled: false
|
|
state: stopped
|
|
|
|
- name: ensure /etc/hosts is correct
|
|
template:
|
|
src: hosts.j2
|
|
dest: /etc/hosts
|
|
|
|
- name: set hostname
|
|
copy:
|
|
content: samba_ad.hostname
|
|
dest: /etc/hostname
|
|
|
|
- name: install samba
|
|
apt:
|
|
name: samba
|
|
state: present
|
|
|
|
- name: test if provisioned
|
|
stat:
|
|
path: /etc/samba/private/krb5.conf
|
|
register: kerberos_config
|
|
|
|
- name: initial provisioning
|
|
shell:
|
|
cmd: >
|
|
samba-tool domain provision \
|
|
--use-rfc2307
|
|
--realm={{ samba_ad.ad_domain }}
|
|
--domain={{ samba_ad.netbios_name }}
|
|
--server-role=dc
|
|
--dns-backend=SAMBA_INTERNAL
|
|
--adminpass={{ samba_ad.admin_password }}
|
|
when: not kerberos_config.stat.exists
|
|
|
|
- name: copy kerberos config (symlinks cause permission errors)
|
|
shell:
|
|
cmd: cp /etc/samba/private/krb5.conf /etc/krb5.conf
|
|
|
|
- name: enable and ensure samba is started
|
|
systemd:
|
|
name: samba
|
|
enabled: true
|
|
state: started
|