{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/packer/issues/3519","repository_url":"https://api.github.com/repos/mitchellh/packer","labels_url":"https://api.github.com/repos/mitchellh/packer/issues/3519/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/packer/issues/3519/comments","events_url":"https://api.github.com/repos/mitchellh/packer/issues/3519/events","html_url":"https://github.com/mitchellh/packer/issues/3519","id":153894180,"number":3519,"title":"ansible remote provisioner cannot be used to build a fresh image (amazon-ebs)","user":{"login":"Daemoen","id":1039884,"avatar_url":"https://avatars.githubusercontent.com/u/1039884?v=3","gravatar_id":"","url":"https://api.github.com/users/Daemoen","html_url":"https://github.com/Daemoen","followers_url":"https://api.github.com/users/Daemoen/followers","following_url":"https://api.github.com/users/Daemoen/following{/other_user}","gists_url":"https://api.github.com/users/Daemoen/gists{/gist_id}","starred_url":"https://api.github.com/users/Daemoen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Daemoen/subscriptions","organizations_url":"https://api.github.com/users/Daemoen/orgs","repos_url":"https://api.github.com/users/Daemoen/repos","events_url":"https://api.github.com/users/Daemoen/events{/privacy}","received_events_url":"https://api.github.com/users/Daemoen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mitchellh/packer/labels/provisioner/ansible-remote","name":"provisioner/ansible-remote","color":"c7def8"},{"url":"https://api.github.com/repos/mitchellh/packer/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-05-09T23:42:46Z","updated_at":"2016-05-10T18:07:04Z","closed_at":null,"body":"bash-4.3$ packer --version\r\n0.10.0\r\n\r\nbash-4.3$ ansible --version\r\nansible 2.0.2.0\r\n  config file = /opt/ansible/packer/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n\r\nBecause of the way that sudo is configured in most distributions (requiretty is *Enabled by default*), and the way that the ansible-provisioner works (Requires using sftp, which is incompatible with set ssh_pty -- See :  #3375 ) you cannot use ansible remote provisioner to build a brand new image from *most* distributions images.\r\n\r\nIf you were to set ssh_pty, you get stuck when the logins occur and the sftp server is executed due to garbage, but you also cannot provision the machines without it, since you *have* to have a pty initially.  The only way around this is to spin your own copy of an *upstream* image, just so that you can build your image without requiretty, save it, and then use that second stage image.  This defeats the entire purpose and concept of what packer is intended for.\r\n\r\nPlease provide a workaround or suggestion, as right now, in order to do this, you would have to rebuild your ami every time an ami is updated upstream, until the upstream images change."},"comment":{"url":"https://api.github.com/repos/mitchellh/packer/issues/comments/218241382","html_url":"https://github.com/mitchellh/packer/issues/3519#issuecomment-218241382","issue_url":"https://api.github.com/repos/mitchellh/packer/issues/3519","id":218241382,"user":{"login":"rickard-von-essen","id":557699,"avatar_url":"https://avatars.githubusercontent.com/u/557699?v=3","gravatar_id":"","url":"https://api.github.com/users/rickard-von-essen","html_url":"https://github.com/rickard-von-essen","followers_url":"https://api.github.com/users/rickard-von-essen/followers","following_url":"https://api.github.com/users/rickard-von-essen/following{/other_user}","gists_url":"https://api.github.com/users/rickard-von-essen/gists{/gist_id}","starred_url":"https://api.github.com/users/rickard-von-essen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickard-von-essen/subscriptions","organizations_url":"https://api.github.com/users/rickard-von-essen/orgs","repos_url":"https://api.github.com/users/rickard-von-essen/repos","events_url":"https://api.github.com/users/rickard-von-essen/events{/privacy}","received_events_url":"https://api.github.com/users/rickard-von-essen/received_events","type":"User","site_admin":false},"created_at":"2016-05-10T18:07:03Z","updated_at":"2016-05-10T18:07:03Z","body":"Then you can use `user_data` or `user_data_file` to remove requiretty. "}}