So your user requires password for sudo. You have to allow nopassword in
sudoers, look at man sudoers.conf 1). You need to configure this before
provisioning, since changing that requires root. On AWS you use
user-data/cloud-init for that see 2) and 3)

1) https://linux.die.net/man/5/sudoers
2) https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html
3) https://cloudinit.readthedocs.io/en/latest/

On Tue, Oct 23, 2018 at 8:01 PM Ibrahim Buamod <[email protected]>
wrote:

> but now I am having this error
>
> amazon-ebs: fatal: [127.0.0.1]: FAILED! => {"changed": false, 
> "module_stderr": "sudo: a password is required\n", "module_stdout": "", 
> "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1} [0m
>
>
>
> On Tuesday, October 23, 2018 at 2:03:12 AM UTC-4, Rickard von Essen wrote:
>>
>> "ansible_env_vars": [
>> "ANSIBLE_NOCOLOR=True","become_user=root","become=true" ],
>>
>> Is incorrect, it should be:
>>
>> "ansible_env_vars": [ "ANSIBLE_NOCOLOR=True" ],
>> "extra_arguments": [ "--become" ],
>>
>> (and --become-user root can be omitted since that is the default, unless
>> you configured this in a custom config file and need to set it back.)
>>
>> On Tue, Oct 23, 2018 at 4:27 AM Ibrahim Buamod <[email protected]>
>> wrote:
>>
>>> I am using packer and the amazon-ebs module but I keep getting this
>>> error
>>>
>>> [0;32m    amazon-ebs: fatal: [default]: FAILED! => {"changed": false, 
>>> "msg": "You need to be root to perform this command.\n", "rc": 1, 
>>> "results": ["Loaded plugins: priorities, update-motd, upgrade-helper\n"]} 
>>> [0m
>>>
>>>
>>> the provisioner
>>>
>>> {
>>>   "type": "ansible",
>>>   "ansible_env_vars": [ 
>>> "ANSIBLE_NOCOLOR=True","become_user=root","become=true" ],
>>>   "playbook_file": "./Ansible/playbook.yml"
>>> }
>>>
>>>
>>>
>>> the ansible playbook is
>>>
>>> ---
>>>
>>> - name: Provision Python
>>>   hosts: all
>>>   gather_facts: no
>>>   tasks:
>>>   - name: install git
>>>     package:
>>>       name: git
>>>       state: present
>>>
>>>
>>> --
>>> 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/5f8f6b8e-8943-458a-b6d2-6fd050224a95%40googlegroups.com
>>> <https://groups.google.com/d/msgid/packer-tool/5f8f6b8e-8943-458a-b6d2-6fd050224a95%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/737b87da-8e8c-4e15-898a-aa4dd5d6ce24%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/737b87da-8e8c-4e15-898a-aa4dd5d6ce24%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-gddUaM87K4-OM5N3SmXLtCOo4j%2B%3DxZrBBvKgGXK4Xxw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to