Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
samba
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infra
ansible-shared
samba
Commits
2f6ece5e
Commit
2f6ece5e
authored
8 years ago
by
Hinrikus Wolf
Browse files
Options
Downloads
Patches
Plain Diff
add ad-server to ansible
parent
4afd54d5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ad-server/handlers/main.yml
+6
-0
6 additions, 0 deletions
ad-server/handlers/main.yml
ad-server/tasks/main.yml
+82
-0
82 additions, 0 deletions
ad-server/tasks/main.yml
ad-server/templates/smb.conf.j2
+26
-0
26 additions, 0 deletions
ad-server/templates/smb.conf.j2
with
114 additions
and
0 deletions
ad-server/handlers/main.yml
0 → 100644
+
6
−
0
View file @
2f6ece5e
---
# file: roles/ad-auth/handlers/main.yml
-
name
:
restart samba-ad-dc server
service
:
name=samba-ad-dc state=restarted
This diff is collapsed.
Click to expand it.
ad-server/tasks/main.yml
0 → 100644
+
82
−
0
View file @
2f6ece5e
---
# file: roles/ad-server/tasks/main.yml
-
name
:
ensure ad-server is installed
apt
:
name=samba state=latest
tags
:
-
packages
-
ad-server
-
name
:
ensure winbind is for some reasons installed
apt
:
name=samba state=latest
tags
:
-
packages
-
ad-server
-
name
:
figure out if domain is provisioned
stat
:
path=/var/lib/samba/sysvol/{{ domain }}
register
:
domain_provisioned
tags
:
-
ad-server
-
domain-provision
-
name
:
ensure smb.conf is absent for provision
file
:
path=/etc/samba/smb.conf state=absent
when
:
domain_provisioned.stat.exists == False
tags
:
-
ad-server
-
domain-provision
-
name
:
get admin password for SAMBA
local_action
:
pass name="samba-admin" state=present generate=20 store=FSMPI_PASSWORD_STORE_DIR limit=yes
register
:
adminpass
when
:
domain_provisioned.stat.exists == False
tags
:
-
ad-server
-
domain-provision
-
password
# provision smb-domain. passwords will be selected at random and safed to /root/smb-provision.log)
# TODO: Evaluate if internal DNS-backend is powerful enough for usecase otherwise bind9 is needed
-
name
:
ensure domain is provisioned
shell
:
samba-tool domain provision --use-rfc2307 --domain={{ smb_domain }} --server-role=dc --host-name={{ ansible_hostname }} --realm={{ REALM }} --dns-backend=SAMBA_INTERNAL --adminpass={{ adminpass.password }} 2> /root/smb-provision.log
when
:
domain_provisioned.stat.exists == False
tags
:
-
ad-server
-
domain-provision
-
name
:
ensure smb.conf is correct
template
:
src=smb.conf.j2 dest=/etc/samba/smb.conf owner=root group=root mode=0644
notify
:
restart samba-ad-dc server
tags
:
-
ad-server
-
config
-
name
:
ensure smbd is stopped and disabled
service
:
name=smbd state=stopped enabled=no
tags
:
-
ad-server
-
service
-
name
:
ensure nmbd is stopped and disabled
service
:
name=nmbd state=stopped enabled=no
tags
:
-
ad-server
-
service
#- name: ensure samba-ad-dc unit is running, enabled and not masked
# systemd: name=samba-ad-dc masked=no state=running enabled=yes
-
debug
:
msg
:
"
Ensure
samba-ad-dc
unit
is
not
masked.
This
functionality
will
come
in
ansible
2.2,
you
should
refactor
this
role"
-
name
:
ensure samba-ad-dc is running and enabled
service
:
name=samba-ad-dc state=running enabled=yes
tags
:
-
ad-server
-
service
-
meta
:
flush_handlers
This diff is collapsed.
Click to expand it.
ad-server/templates/smb.conf.j2
0 → 100644
+
26
−
0
View file @
2f6ece5e
# Global parameters
[global]
workgroup = {{ smb_domain }}
realm = {{ REALM }}
netbios name = {{ ansible_hostname }}
server role = active directory domain controller
idmap_ldb:use rfc2307 = yes
idmap config uid : range = 10000-20000
idmap config gid : range = 10000-20000
template shell = /bin/bash
template homedir = /home/%U
registry shares = no
dns forwarder = {{ dns_forward }}
username map = /etc/samba/usermap.map
[netlogon]
path = /var/lib/samba/sysvol/{{ domain }}/scripts
read only = No
[sysvol]
path = /var/lib/samba/sysvol
read only = No
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment