update AD jobs
This commit is contained in:
44
windows/create_ad_domain.yml
Normal file
44
windows/create_ad_domain.yml
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
- name: Create Active Directory domain
|
||||
hosts: "{{ HOSTS | default('windows') }}"
|
||||
gather_facts: false
|
||||
|
||||
tasks:
|
||||
- name: Create new domain in a new forest on the target host
|
||||
ansible.windows.win_domain:
|
||||
dns_domain_name: ansible.local
|
||||
safe_mode_password: "{{ ansible_password }}"
|
||||
register: new_forest
|
||||
|
||||
- name: Reboot the target host
|
||||
ansible.windows.win_reboot:
|
||||
reboot_timeout: 3600
|
||||
when: new_forest.reboot_required
|
||||
|
||||
- name: Wait up to 10min for AD web services to start
|
||||
community.windows.win_wait_for_process:
|
||||
process_name_exact: Microsoft.ActiveDirectory.WebServices
|
||||
pre_wait_delay: 60
|
||||
state: present
|
||||
timeout: 600
|
||||
sleep: 10
|
||||
|
||||
- name: Create some groups
|
||||
community.windows.win_domain_group:
|
||||
name: "{{ item.name }}"
|
||||
scope: global
|
||||
loop:
|
||||
- { name: "GroupA" }
|
||||
- { name: "GroupB" }
|
||||
- { name: "GroupC" }
|
||||
|
||||
- name: Create some users
|
||||
community.windows.win_domain_user:
|
||||
name: "{{ item.name }}"
|
||||
groups: "{{ item.groups }}"
|
||||
password: "{{ ansible_password }}"
|
||||
update_password: on_create
|
||||
loop:
|
||||
- { name: "UserA", groups: "GroupA" }
|
||||
- { name: "UserB", groups: "GroupB" }
|
||||
- { name: "UserC", groups: "GroupC" }
|
||||
Reference in New Issue
Block a user