justin-p/ansible-role-pdc

Skip computer with new name because the new name is not valid. The new computer name entered is not properly formatted.

patsevanton opened this issue · 2 comments

Hello! Thanks for role ansible-role-pdc.
I try run role for windows server 2019

sudo apt update
sudo apt install git jq python3-pip -y
sudo pip3 install ansible pywinrm
ansible-galaxy collection install ansible.windows
ansible-galaxy install justin_p.pdc

Inventory file:

[windows]
windows.local ansible_host=xxxxxxxx

[windows:vars]
ansible_port=5986
ansible_connection=winrm
ansible_winrm_transport=basic
ansible_user=Administrator
ansible_password=yyyyyy
ansible_winrm_server_cert_validation=ignore

Run playbook

ansible-playbook -i inventory active_directory.yml

Get error

TASK [justin_p.wincom : Ensure hostname is set to windows.local] **********************************************************************************************************
fatal: [windows.local]: FAILED! => changed=false 
  msg: 'Failed to rename computer to ''windows.local'': Skip computer ''windows-server2'' with new name ''windows.local'' because the new name is not valid. The new computer name entered is not properly formatted. Standard names may contain letters (a-z, A-Z), numbers (0-9), and hyphens (-), but no spaces or periods (.). The name may not consist entirely of digits, and may not be longer than 63 characters.'
  old_name: windows-server2
  reboot_required: false

Please add example inventory to readme.
Thanks!

If use inventory

[windows]
windows-server3 ansible_host=xxxx

Dont get error

TASK [justin_p.wincom : Ensure hostname is set to windows-server3] 
ok: [windows-server3]

Can i add example inventory to readme?

[windows]
windows-server ansible_host=xxxxxxxx

[windows:vars]
ansible_port=5986
ansible_connection=winrm
ansible_winrm_transport=basic
ansible_user=Administrator
ansible_password=yyyyyy
ansible_winrm_server_cert_validation=ignore

Hia @patsevanton, an example inventory is included in the tests folder. https://github.com/justin-p/ansible-role-pdc/blob/master/tests/inventory.yml. Updated the README to point towards this example.