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

30 views
Skip to first unread message

Christian Sarazin

unread,
Sep 17, 2015, 9:57:59 AM9/17/15
to Ansible Project
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
    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

Brian Coca

unread,
Sep 21, 2015, 3:12:50 PM9/21/15
to Ansible Project
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.

--
Brian Coca
Reply all
Reply to author
Forward
0 new messages