Hello guys:
I have a doubt. What's the currently recommended or supported way of provisioning Windows with ansible on EC2?
I mean, there's a Ansible connection plugin for Packer that must be created (downloaded or installed) before attempting to use a code like this:
"provisioners": [
{
"type": "ansible",
"playbook_file": "../playbooks/windows_image_build/playbook.yml",
"extra_arguments": [
"--extra-vars", "{'environment_name': 'packer', 'hosting_environment': 'aws', 'connection': 'packer'}",
"--skip-tags", "gitchecks",
"--skip-tags", "gather_facts",
"--skip-tags", "slack"
]
}
]
The other way I had in mind is running ansible with shell-local, like this:
"provisioners": [
{
"type": "shell-local",
"inline": [
"ansible-playbook -i {{ user `os_ipaddr` }}, \\",
"-e ansible_user='{{ user `os_adminuser` }}' \\",
"-e ansible_password='{{ user `os_adminpass` }}' \\",
"-e os_update='{{ user `os_update` }}' \\",
"-e os_firstinstall={{ user `os_firstinstall`}} \\",
"{{ user `ansible_playbook` }}"
]
}
]
(please ignore my custom vars)
I'm not sure how to setup my connection plugin for ansible 2.8.x. Any ideas on this?
Otherwise, do you know how can I get the public IPv4 and password for my recently created Windows EC2 instance? I'm not sure if {{.WinRMPassword}} variable is valid here.
Hope someone can give me some guidance.
Thanks in advance