title: Chef Tag Node inside ruby_block
body: <p>Problem: 
  I want to selectively restart a service in chef based on the role of the node. If i don't do a restart i would like to tag the node for for a restart at a later time.</p>
  
  <p>Currently I have some code that looks like this</p>
  
  <pre><code>template '/etc/docker/daemon.json' do
    source 'daemon.json.erb'
    mode '0644'
    notifies :run, 'ruby_block[start_right_service]', :immediately
  end
  
  ruby_block 'start_right_service' do
    action :nothing
    block do
      if node.role?('dev') ||
         node.role?('desktop')
        Chef::Log.info('Fireing off a restart this node')
        resources(service: 'docker').run_action(:restart)
      else
        Chef::Log.info('Not allowed to restart this node')
        node.run_state['pending_docker_restart'] = true
      end
    end
  end
  </code></pre>
  
  <p>So i can't use tag inside the ruby_block as i receive  </p>
  
  <blockquote>
    <p>undefined method `tag' for Chef::Resource::RubyBlock</p>
  </blockquote>
  
  <p>I have also tried passing out the variable with node.run_state, but this doesn't seem to work either. any idea's to work around this would be greatly appreciated </p>