title: How to configure software using chef and vagrant after install recipe runs
body: <p>Thanks for taking a look at this question. Any help is appreciated.
  I am provisioning a virtual machine with a GUI using vagrant and chef.</p>
  
  <p>Goal: to download IntelliJ IDE and then install it so that it is available to my user when I log in.</p>
  
  <p>The cookbook <code>cookbook 'idea', '~&gt; 0.4.0'</code>achieves the download but a user must manually complete the install on the guest.</p>
  
  <p>I am having trouble with my custom recipe to complete the configuration with chef. As it is written, the recipe completes if I add it to the run list after the machine is provisioned but fails in the initial run because files are not yet installed.</p>
  
  <p>I tried using the <code>only_if</code> method within the relevant blocks and on the entire recipe, but couldn't get it to work. I also messed with the <code>subscribe</code> method but couldn't get that to work either.</p>
  
  <p>I'm sure this has an easy solution, but Googling and trial and error are not getting me any closer. I would appreciate any help to achieve the goal. Thanks!</p>
  
  <p><strong>Current recipe</strong></p>
  
  <pre><code># Configure IntelliJ Idea.
  file '/opt/idea/idea.desktop' do
    content '[Desktop Entry]
        Name=IntelliJ IDEA
        Type=Application
        Exec=idea
        Terminal=false
        Icon=idea
        Comment=Integrated Development Environment
        NoDisplay=false
        Categories=Development;IDE;
        Name[en]=IntelliJ IDEA'
    mode '644'
    owner 'root'
    group 'root'
  end
  
  bash 'install idea desktop' do
    code &lt;&lt;-EOH
    cd /opt/idea
    sudo desktop-file-install idea.desktop
    EOH
  end
  
  file '/usr/share/pixmaps/idea.png' do
    owner 'root'
    group 'root'
    mode '0644'
    content ::File.open('/opt/idea/bin/idea.png').read
    action :create
  end
  
  link '/usr/local/bin/idea' do
    to '/opt/idea/bin/idea.sh'
    link_type :symbolic
  end
  </code></pre>
  
  <p><strong>Failed efforts:</strong>
  Wrapping the entire script    </p>
  
  <pre><code> # Configure IntelliJ Idea.
      execute 'configure idea' do
        only_if { ::File.exist?("/opt/idea") }
      continues...
      end
  </code></pre>
  
  <p>Using <code>only_if</code> in the blocks</p>
  
  <pre><code>file '/usr/share/pixmaps/idea.png' do
      action :create
      only_if { ::File.exist?('/opt/idea/bin/idea.png') }
      owner 'root'
      group 'root'
      mode '0644'
      content ::File.open('/opt/idea/bin/idea.png').read
    end
  
    link '/usr/local/bin/idea' do
      to '/opt/idea/bin/idea.sh'
      only_if { ::File.exist?('/opt/idea/bin/idea.sh') }
      link_type :symbolic
    end
  </code></pre>