It's really hard for me to help much more without a full repro case. The
general advice I can give is to use a existing ssh_keypair that you have
access to and run with --on-error=ask and wait for ansible to fail, jump
into the instance and troubleshoot (check syslog and auth logs).

Just to give you something to compare with here is a working example:

{
  "builders": [
    {
      "type": "amazon-ebs",
      "region": "eu-west-1",
      "source_ami_filter": {
        "filters": {
          "virtualization-type": "hvm",
          "name": "CentOS Linux 7 x86_64 HVM EBS*",
          "root-device-type": "ebs"
        },
        "owners": ["410186602215"],
        "most_recent": true
      },
      "instance_type": "t2.micro",
      "ssh_username": "centos",
      "ssh_pty": "true",
      "ami_name": "packer-demo-{{timestamp}}"
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline": [
        "echo Hi"
      ]
    },
    {
      "type": "ansible",
      "playbook_file": "./playbook.yml"
    }
  ]
}


playbook.yml:

---
- hosts: all
  become: yes
  tasks:
    - name: Debug
      debug: msg=Hi
    - name: Shelling
      shell: id


On 11 October 2017 at 12:27, rick turner <[email protected]>
wrote:

> It's working with `ansible-local` provisioner but not with `ansible`
> provisioner
>
> --
> 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 [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/packer-tool/9a2c15fb-cde3-41bb-be47-e4d45feacad7%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/9a2c15fb-cde3-41bb-be47-e4d45feacad7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt-x87JU1KVQ%2BhquaQWqNBvrWed32XAbk3RLRmCmSZ%3D25Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to