{"id":22013560,"url":"https://github.com/sky-joker/ansible-vmware-windows-winrm-setup","last_synced_at":"2026-04-10T21:06:37.216Z","repository":{"id":196155142,"uuid":"195518527","full_name":"sky-joker/ansible-vmware-windows-winrm-setup","owner":"sky-joker","description":"This playbook for enabling WinRM of WIndows running on VMware ESXi.","archived":false,"fork":false,"pushed_at":"2019-07-06T17:54:11.000Z","size":8,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-28T15:16:53.631Z","etag":null,"topics":["ansible","vmware","windows","winrm"],"latest_commit_sha":null,"homepage":"https://sky-joker.tech/2019/07/06/vmware-esxi%e4%b8%8a%e3%81%a6%e3%82%99%e7%a8%bc%e5%83%8d%e3%81%97%e3%81%a6%e3%81%84%e3%82%8bwindows%e3%81%aewinrmhttps%e3%81%ae%e6%9c%89%e5%8a%b9%e5%8c%96%e3%82%92ansible%e3%81%a6%e3%82%99%e8%87%aa/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sky-joker.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-07-06T08:52:23.000Z","updated_at":"2023-10-23T08:34:04.000Z","dependencies_parsed_at":"2023-09-21T21:30:56.403Z","dependency_job_id":null,"html_url":"https://github.com/sky-joker/ansible-vmware-windows-winrm-setup","commit_stats":null,"previous_names":["sky-joker/ansible-vmware-windows-winrm-setup"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky-joker%2Fansible-vmware-windows-winrm-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky-joker%2Fansible-vmware-windows-winrm-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky-joker%2Fansible-vmware-windows-winrm-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sky-joker%2Fansible-vmware-windows-winrm-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sky-joker","download_url":"https://codeload.github.com/sky-joker/ansible-vmware-windows-winrm-setup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245074687,"owners_count":20556788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","vmware","windows","winrm"],"created_at":"2024-11-30T03:23:55.430Z","updated_at":"2026-04-10T21:06:37.170Z","avatar_url":"https://github.com/sky-joker.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ansible VMware Windows WinRM setup\n\n[![](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/sky-joker/ansible-vmware-windows-winrm-setup/blob/master/LICENSE.txt)\n\nThis Playbook can do the following:\n\n* Create certificate for WinRM\n* Import certificate for WinRM to Windows running on VMware ESXi\n* Confirming Remote Host Communication Using WinRM\n\nCertificates and powershells for import are copied using the vSphere API.  \nAfter copying, powershell is execute with vSphere API.\n\n## Requirements\n\n* [vmware-guest-file-operation](https://github.com/sky-joker/vmware-guest-file-operation)\n\n## Install\n\nClone this repository.\n\n```\n$ git clone https://github.com/sky-joker/ansible-vmware-windows-winrm-setup.git\n```\n\nClone [vmware-guest-file-operation](https://github.com/sky-joker/vmware-guest-file-operation) repository.\n\n```\n$ git clone https://github.com/sky-joker/vmware-guest-file-operation.git\n```\n\nInstall the required python module.\n\n```\n$ pip install -r vmware-guest-file-operation/requirements.txt\n$ pip install pyOpenSSL pywinrm\n```\n\nMove the directory by giving execute permission to `vmware-guest-file-operation.py`.\n\n```\n$ chmod +x vmware-guest-file-operation/vmware-guest-file-operation.py\n$ mv vmware-guest-file-operation/vmware-guest-file-operation.py ansible-vmware-windows-winrm-setup\n```\n\nMove to `ansible-vmware-windows-winrm-setup` directory.\n\n```\n$ cd ansible-vmware-windows-winrm-setup\n```\n\n## Usage example\n\nPlease rewrite `vars/vmware_parameters.yml` and `vars/certificate_parameters.yml` and `inventory` according to the environment.\n\n`vmware_parameters.yml` is a VMware parameter vars file.\n\n```yaml\n---\nhostname: change to vCenter IP or hostname.\nusername: administrator@vsphere.local\npassword: change to vCenter login user password.\ndatacenter: change to data center name where Windows VM running.\n```\n\n`certificate_parameters.yml` is a server certificate parameter vars file.\n\n```yaml\n# certificate directory.\nroot_dir: change to directory name for saving certificate related files.\n \n# windows\nwindows_save_path: C:\\Users\\Administrator\\Desktop\npowershell_absolute_path: C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\n \n# Parameters to sign a certificate.\ncertificate_term: server certificate expiration date.\nca_certificate_term: ca expiration date.\n \n# Parameters to csr files.\nserver_certificate_parameters:\n  - common_name: common name(Host name displayed by $ENV:COMPUTERNAME).\n    private_key_password: private key password.\n    private_key_chipher: private key chipher.\n    private_key_size: private key size(bits).\n    friendly_name: friendly name.\n    pfx_password: password for PKCS12 for import.\n    vm_name: vm name displayed on VMware.\n    vm_username: user name for guest os.\n    vm_password: user password for guest os.\n```\n\nIf more than one certificate is required, add to `server_certificate_parameters`.  \nfor example:\n\n```yaml\n# Parameters to csr files.\nserver_certificate_parameters:\n  - common_name: WINDOWS01\n    private_key_password: password\n    private_key_chipher: des3\n    private_key_size: 2048\n    friendly_name: ansible\n    pfx_password: password\n    vm_name: Windows01\n    vm_username: Administrator\n    vm_password: secret\n \n  - common_name: WINDOWS02\n    private_key_password: password\n    private_key_chipher: des3\n    private_key_size: 2048\n    friendly_name: ansible\n    pfx_password: password\n    vm_name: Windows02\n    vm_username: Administrator\n    vm_password: secret\n```\n\ninventory file example.  \nAdd host to windows group and change `ansible_host` and `ansible_password`.\n\n```\n[windows]\nwindows01 ansible_host=192.168.0.155 ansible_user=Administrator ansible_password=secret\nwindows02 ansible_host=192.168.0.156 ansible_user=Administrator ansible_password=secret\n \n[windows:vars]\nansible_connection=winrm\nansible_winrm_transport=ntlm\nansible_port=5986\nansible_winrm_server_cert_validation=ignore\n```\n\nRun Playbook after modifying the vars file.\n\n```\n$ ansible-playbook main.yml -i inventory\n(snip)\nTASK [Wait for listening on 5986 port.] *********************************************************************************************************************************************************\nok: [windows02 -\u003e localhost]\nok: [windows01 -\u003e localhost]\n \nTASK [Win Ping.] ********************************************************************************************************************************************************************************\nok: [windows02]\nok: [windows01]\n \nPLAY RECAP **************************************************************************************************************************************************************************************\nlocalhost                  : ok=13   changed=5    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0\nwindows01                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0\nwindows02                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0\n```\n\nThe powershell created for server certificate and certificate import is saved as follows.\n\n```\n$ tree certificate/\ncertificate/\n|-- WINDOWS01\n|   |-- WINDOWS01.crt\n|   |-- WINDOWS01.csr\n|   |-- WINDOWS01.key\n|   `-- WINDOWS01.pfx\n|-- WINDOWS02\n|   |-- WINDOWS02.crt\n|   |-- WINDOWS02.csr\n|   |-- WINDOWS02.key\n|   `-- WINDOWS02.pfx\n`-- powershell\n    |-- WINDOWS01.ps1\n    `-- WINDOWS02.ps1\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.txt](https://github.com/sky-joker/ansible-vmware-windows-winrm-setup/blob/master/LICENSE.txt) file for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsky-joker%2Fansible-vmware-windows-winrm-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsky-joker%2Fansible-vmware-windows-winrm-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsky-joker%2Fansible-vmware-windows-winrm-setup/lists"}