This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
forked from ansible/product-demos
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zachary LeBlanc
authored
Jun 5, 2023
1 parent
4d34ea9
commit c0d4493
Showing
4 changed files
with
62 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
- name: Join Active Directory domain | ||
hosts: "{{ _hosts | default(omit) }}" | ||
gather_facts: false | ||
|
||
tasks: | ||
- name: Set a single address on the adapter named Ethernet | ||
ansible.windows.win_dns_client: | ||
adapter_names: 'Ethernet*' | ||
dns_servers: "{{ hostvars[domain_controller]['private_ip_address'] }}" | ||
|
||
- name: Ensure Demo OU exists | ||
delegate_to: "{{ domain_controller }}" | ||
community.windows.win_domain_ou: | ||
name: Demo | ||
state: present | ||
|
||
- name: Join ansible.local domain | ||
register: r_domain_membership | ||
ansible.windows.win_domain_membership: | ||
dns_domain_name: ansible.local | ||
hostname: "{{ inventory_hostname }}" | ||
domain_admin_user: "{{ ansible_user }}@ansible.local" | ||
domain_admin_password: "{{ ansible_password }}" | ||
domain_ou_path: "OU=Demo,DC=ansible,DC=local" | ||
state: domain | ||
|
||
- name: Reboot windows machine | ||
when: r_domain_membership.reboot_required | ||
ansible.windows.win_reboot: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters