@@ -39,3 +39,5 @@ Please push contributions via a pull request following the naming convention of
|
|||||||
- Extra vars:
|
- Extra vars:
|
||||||
|
|
||||||
demo: <linux or windows>
|
demo: <linux or windows>
|
||||||
|
|
||||||
|
4. If you require a Windows Active Directory domain you will need to run the "ACTIVE DIRECTORY / Create Active Directory domain" template after the Windows setup completes. This will create the "ansible.local" domain as well as a few generic users and groups.
|
||||||
@@ -10,5 +10,6 @@ collections:
|
|||||||
- containers.podman
|
- containers.podman
|
||||||
#windows
|
#windows
|
||||||
- chocolatey.chocolatey
|
- chocolatey.chocolatey
|
||||||
|
- community.windows
|
||||||
#
|
#
|
||||||
- azure.azcollection
|
- azure.azcollection
|
||||||
|
|||||||
34
windows/active_directory/create_ad_domain.yml
Normal file
34
windows/active_directory/create_ad_domain.yml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
- name: Create Active Directory domain
|
||||||
|
hosts: "{{ HOSTS | default('windows') }}"
|
||||||
|
|
||||||
|
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: "{{ lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1) }}"
|
||||||
|
register: new_forest
|
||||||
|
|
||||||
|
- name: Reboot the target host
|
||||||
|
ansible.windows.win_reboot:
|
||||||
|
reboot_timeout: 3600
|
||||||
|
when: new_forest.reboot_required
|
||||||
|
|
||||||
|
- 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: "{{ lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1) }}"
|
||||||
|
loop:
|
||||||
|
- { name: "UserA", groups: "GroupA" }
|
||||||
|
- { name: "UserB", groups: "GroupB" }
|
||||||
|
- { name: "UserC", groups: "GroupC" }
|
||||||
38
windows/active_directory/helpdesk_new_user_portal.yml
Normal file
38
windows/active_directory/helpdesk_new_user_portal.yml
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
- name: Helpdesk new user portal
|
||||||
|
hosts: "{{ HOSTS | default('windows') }}"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Setting host facts using complex arguments
|
||||||
|
set_fact:
|
||||||
|
temp_password: "{{ lookup('community.general.random_string', min_lower=1, min_upper=1, min_special=1, min_numeric=1) }}"
|
||||||
|
# Example result: ['&Qw2|E[-']
|
||||||
|
|
||||||
|
- name: Create new user
|
||||||
|
community.windows.win_domain_user:
|
||||||
|
name: "{{ firstname }} {{ surname }}"
|
||||||
|
firstname: "{{ firstname }}"
|
||||||
|
surname: "{{ surname }}"
|
||||||
|
sam_account_name: "{{ firstname[0] }}{{ surname }}"
|
||||||
|
company: BobCo
|
||||||
|
password: "{{ temp_password }}"
|
||||||
|
state: present
|
||||||
|
groups:
|
||||||
|
- "GroupA"
|
||||||
|
- "GroupB"
|
||||||
|
street: 123 4th St.
|
||||||
|
city: Sometown
|
||||||
|
state_province: IN
|
||||||
|
postal_code: 12345
|
||||||
|
country: US
|
||||||
|
attributes:
|
||||||
|
telephoneNumber: 555-123456
|
||||||
|
register: new_user
|
||||||
|
|
||||||
|
- name: Display User
|
||||||
|
debug:
|
||||||
|
var: new_user
|
||||||
|
|
||||||
|
- name: Show temp password
|
||||||
|
debug:
|
||||||
|
var: temp_password
|
||||||
@@ -163,3 +163,43 @@ controller_templates:
|
|||||||
choices:
|
choices:
|
||||||
- 'Running'
|
- 'Running'
|
||||||
- 'Stopped'
|
- 'Stopped'
|
||||||
|
|
||||||
|
- name: "ACTIVE DIRECTORY / Create Active Directory domain"
|
||||||
|
job_type: run
|
||||||
|
inventory: "Workshop Inventory"
|
||||||
|
project: "Ansible official demo project"
|
||||||
|
playbook: "windows/active_directory/create_ad_domain.yml"
|
||||||
|
execution_environment: Default execution environment
|
||||||
|
credentials:
|
||||||
|
- "Workshop Credential"
|
||||||
|
survey_enabled: true
|
||||||
|
survey:
|
||||||
|
name: ''
|
||||||
|
description: ''
|
||||||
|
spec:
|
||||||
|
- question_name: Server Name or Pattern
|
||||||
|
type: text
|
||||||
|
variable: HOSTS
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- name: "ACTIVE DIRECTORY / Helpdesk new user portal"
|
||||||
|
job_type: run
|
||||||
|
inventory: "Workshop Inventory"
|
||||||
|
project: "Ansible official demo project"
|
||||||
|
playbook: "windows/active_directory/helpdesk_new_user_portal.yml"
|
||||||
|
execution_environment: Default execution environment
|
||||||
|
credentials:
|
||||||
|
- "Workshop Credential"
|
||||||
|
survey_enabled: true
|
||||||
|
survey:
|
||||||
|
name: ''
|
||||||
|
description: ''
|
||||||
|
spec:
|
||||||
|
- question_name: Firstname
|
||||||
|
type: text
|
||||||
|
variable: firstname
|
||||||
|
required: true
|
||||||
|
- question_name: Surname
|
||||||
|
type: text
|
||||||
|
variable: surname
|
||||||
|
required: true
|
||||||
|
|||||||
Reference in New Issue
Block a user