# Greengrass: Adding device fails first time

**URL:** <https://forum.ansible.com/t/greengrass-adding-device-fails-first-time/34968>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [April 13, 2021, 2:52am UTC](https://forum.ansible.com/t/greengrass-adding-device-fails-first-time/34968 "2021-04-13T02:52:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![niran](https://avatars.discourse-cdn.com/v4/letter/n/4491bb/32.png) [@niran](https://forum.ansible.com/u/niran)\
**Post date:** [April 13, 2021, 2:52am UTC](https://forum.ansible.com/t/greengrass-adding-device-fails-first-time/34968/1 "2021-04-13T02:52:05Z")

</div>

Hi  
i am having some issue adding a new device D35 to greengrass .  
The first time the role is run on devices newly added to {{ api\_greengrass\_group\_thing\_list }} the playbook will fail at this point but then running the playbook a second time the error will go away.

TASK [aws.greengrass : Template out device config] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [zzz-ops-greengrass-1]: FAILED! =\> {“changed”: false, “msg”: “AnsibleUndefinedVariable: ‘dict object’ has no attribute u’D35\_cert\_arn’”}  
[WARNING]: Failure using method (v2\_runner\_on\_failed) in callback plugin (\<ansible.plugins.callback.mail.CallbackModule  
object at 0x7f2a1bdfda50\>): [Errno 111] Connection refused

Need some hints what could me the issue.

---

<div class="post-metadata">

**Author:** ![Komal\_Suthar](https://avatars.discourse-cdn.com/v4/letter/k/919ad9/32.png) [@Komal\_Suthar](https://forum.ansible.com/u/Komal_Suthar)\
**Post date:** [April 13, 2021, 7:09am UTC](https://forum.ansible.com/t/greengrass-adding-device-fails-first-time/34968/2 "2021-04-13T07:09:23Z")

</div>

There are two error first the variable it is looking for it didn’t get and the connection is not established try to resolve this, then try again.
