Before we run the playbook, we need to add the following to group_vars/common.yml:
environment_name: "windows_example"ec2_region: "eu-west-1"
The host inventory file called production should contain the following:
[ec2_instance][ec2_instance:vars]ansible_connection=winrmansible_user="Administrator"ansible_password="{{ lookup('password', 'group_vars/generated_administrator chars=ascii_letters,digits length=30') }}"ansible_winrm_server_cert_validation=ignore
As you can see, we are using the WinRM connector to connect to our Windows instance using the administrator username and the password we set when running the user data script when launching the instance. The site.yml file should have the following content:
---- name: ...