# Using register inside a role and user the registered output in another role...working?

**URL:** <https://forum.ansible.com/t/using-register-inside-a-role-and-user-the-registered-output-in-another-role-working/19286>\
**Category:** Ansible Project\
**Created:** [September 17, 2015, 12:33pm UTC](https://forum.ansible.com/t/using-register-inside-a-role-and-user-the-registered-output-in-another-role-working/19286 "2015-09-17T12:33:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christian\_Sarazin](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@Christian\_Sarazin](https://forum.ansible.com/u/Christian_Sarazin)\
**Post date:** [September 17, 2015, 12:33pm UTC](https://forum.ansible.com/t/using-register-inside-a-role-and-user-the-registered-output-in-another-role-working/19286/1 "2015-09-17T12:33:26Z")

</div>

Hi Guys,

I’ve got 2 and more roles.

Role1:

`

- name: App is deployed msg  
sudo: yes  
debug: msg=“App is deployed to domain.tld”  
register: slack  
`

Role2:

`

- name: Send notification message via Slack  
local\_action:  
module: slack  
domain: [domain.slack.com](http://domain.slack.com)  
channel: “#blaaaa”  
token: supersecrettoken  
msg: “{{slack.stdout}}”

`

How can i reference in Role2 the slack.stdout from the Role1 register? I don’t get it. Or is there another solution to handle this? Can i write the output from register in Role1 to a variable? So i could call this in Role2 ?

Cheers  
Christian

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [September 21, 2015, 7:12pm UTC](https://forum.ansible.com/t/using-register-inside-a-role-and-user-the-registered-output-in-another-role-working/19286/2 "2015-09-21T19:12:45Z")

</div>

That should 'just work', registered vars are attached to the host  
after that task is run, as long as that role runs first the variable  
should be available.
