Skip to content

Commit

Permalink
Use wincom for DRY
Browse files Browse the repository at this point in the history
  • Loading branch information
justin-p committed Apr 8, 2020
1 parent 5cb382e commit e32e91e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ Works on

## Dependencies

WinRM on the windows host should configured for Ansible.
- WinRM on the windows host should configured for Ansible.
- justin_p.wincom
- justin_p.posh5

## Example Playbook

Expand Down
3 changes: 2 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
# defaults file for ansible-pdc
pdc_administrator_username: Administrator
pdc_administrator_password: P@ssw0rd!
pdc_delayed_services: [WinRM]
pdc_dns_nics: "*"
pdc_dns_servers: "{{ ansible_host }}"
pdc_domain: ad.example.test
pdc_netbios: TEST
pdc_domain_safe_mode_password: P@ssw0rd!
pdc_domain_functional_level: Default
pdc_forest_functional_level: Default
pdc_required_psmodules: ["ActiveDirectoryDsc"]
pdc_required_psmodules: [xPSDesiredStateConfiguration, NetworkingDsc, ComputerManagementDsc, ActiveDirectoryDsc]
pdc_required_features: ["AD-domain-services", "DNS"]
8 changes: 7 additions & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,10 @@ galaxy_info:
- 2019
galaxy_tags: ["activedirectory", "ad", "domaincontroller", "pdc"]
dependencies:
- { role: justin_p.wincom }
- role: justin_p.wincom
version: v0.0.2
vars:
wincom_required_psmodule: "{{ pdc_required_psmodules }}"
wincom_service_delayed: "{{ pdc_delayed_services }}"
wincom_dns_nics: "{{ pdc_dns_nics }}"
wincom_dns_servers: "{{ pdc_dns_servers }}"
13 changes: 1 addition & 12 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@
groups: administrators
when: not ansible_windows_domain_member

- name: Ensure required DSC resources and Powershell Modules are present
win_psmodule:
name: "{{ item }}"
state: present
with_items: "{{ pdc_required_psmodules }}"

- name: Ensure DNS Servers on adapter {{ pdc_dns_nics }} are set to {{ pdc_dns_servers }}
win_dns_client:
adapter_names: "{{ pdc_dns_nics }}"
ipv4_addresses: "{{ pdc_dns_servers }}"

- name: Ensure there is a Active Directory domain and forest on {{ ansible_hostname }}
win_domain:
dns_domain_name: "{{ pdc_domain }}"
Expand All @@ -57,7 +46,7 @@
- name: Ensure the UserPrincipalName of {{ pdc_netbios }}\{{ pdc_administrator_username }} is set to {{ pdc_administrator_username }}@{{ pdc_domain }}
win_domain_user:
name: "{{ pdc_administrator_username }}"
upn: "{{ pdc_administrator_username }}@{{ pdc_domain }}"
upn: "{{ pdc_administrator_username }}@{{ pdc_domain }}"
domain_username: "{{ pdc_netbios }}\\{{ pdc_administrator_username }}"
domain_password: "{{ pdc_administrator_password }}"
update_password: on_create
Expand Down

0 comments on commit e32e91e

Please sign in to comment.