To get the IP for running ansible in shell-local do:

A) Run a shell provisioner that saves the IP in a file. Use a file
provisioner to download it and read it in the shell-local script.
Or B) use some aws tag specific to this build and run the aws cli to find
the IP of that instance.

I would expect Ansible 2.8 with WinRM support in Packer to be at best
rocky. But if you are into troubleshooting things it's probably worth at
least trying.

On Mon, Aug 26, 2019 at 6:22 PM Angel Rengifo Cancino <arengi...@gmail.com>
wrote:

> 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
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to packer-tool+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/CAA3McK9buB6U1Buw8%3D%3DAJm17Tf9wbM-JhQySLziEbS_4UVJnEA%40mail.gmail.com
> <https://groups.google.com/d/msgid/packer-tool/CAA3McK9buB6U1Buw8%3D%3DAJm17Tf9wbM-JhQySLziEbS_4UVJnEA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt-xJUGT-VdnMA-dRU99Qw4Z0h3Yfqt5bKtuK1FSz1_fpw%40mail.gmail.com.

Reply via email to