yes you are right Essen
but the thing is i am not sure what user shall i use as the ami i am using 
is rhel7 and by default ec2-user has sudo previleges.
Not sure about with what user does packer executes all these things. weird 
thing is if i put sudo in shell provisioner, it works fine but in ansible i 
am using become: yes, it's not helping out.
I have also tried using like:

{
            "type": "ansible",
            "user": "ec2-user",
            "playbook_file": "./ansible/site.yml"
}

Still No luck


On Wednesday, October 11, 2017 at 9:57:24 AM UTC+5:30, Rickard von Essen 
wrote:
>
> Seems like your user is not allowed to do sudo without password.
>
> On 11 October 2017 at 06:00, rick turner <[email protected] 
> <javascript:>> wrote:
>
>> Description:
>> -----------------
>> I am trying to execute a ansible playbook in my base.json but it's 
>> throwing me permission related errors:
>>
>> Error:
>> -------
>> amazon-ebs: fatal: [localhost]: FAILED! => {"changed": false, "failed": 
>> true, "module_stderr": "sudo: a password is required\n", "module_stdout": 
>> "", "msg": "MODULE FAILURE", "parsed": false}
>>
>> site.yml:
>> ------------
>> ---
>> - hosts: localhost
>>   become: yes
>>   roles:
>>     - tomcat
>>
>>
>> base.json:
>> --------------
>>
>> {
>>
>>     "provisioners": [{
>>             "type": "shell",
>>             "inline": [
>>                 "sleep 5"
>>             ]
>>         },
>>         {
>>             "type": "ansible",
>>             "playbook_file": "./ansible/site.yml"
>>         }
>>     ],
>>     "builders": [{
>>         "type": "amazon-ebs",
>>         "access_key": "",
>>         "secret_key": "",
>>         "region": "***********",
>>         "subnet_id": "***********",
>>         "vpc_id": "***********",
>>         "source_ami": "**********",
>>         "instance_type": "t2.micro",
>>         "ssh_username": "ec2-user",
>>         "ami_name": "tomcat {{timestamp}}",
>>         "ssh_pty": "true",
>>         "security_group_ids": ["***********", "***********"]
>>     }]
>> }
>>
>>
>> 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 [email protected] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/packer-tool/da34e3b5-6a3d-4392-9728-bd9817ba0e09%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/packer-tool/da34e3b5-6a3d-4392-9728-bd9817ba0e09%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/b3648f66-fa95-4f30-b8b6-12c99ad94718%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to