Skip to content

Instantly share code, notes, and snippets.

@fabiang
Created February 12, 2016 09:52
Show Gist options
  • Save fabiang/f0a1c93204458c47c00a to your computer and use it in GitHub Desktop.
Save fabiang/f0a1c93204458c47c00a to your computer and use it in GitHub Desktop.

Revisions

  1. fabiang created this gist Feb 12, 2016.
    7 changes: 7 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    [Create a Github access token](https://github.com/settings/tokens) and set it globally with:

    ```
    git config --global github.accesstoken your_access_token
    ```

    You can also set a separate token for each project, if you don't pass `--global` to `git config`.
    15 changes: 15 additions & 0 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    GITHUB_ACCESSTOKEN=`git config github.accesstoken`.strip!

    Vagrant.configure("2") do |config|
    config.vm.define "foobar" do |foobar|
    foobar.vm.provision :puppet do |puppet|
    puppet.facter = {
    "ssh_username" => "vagrant",
    "github_accesstoken" => GITHUB_ACCESSTOKEN,
    }
    puppet.manifests_path = "puppet/manifests"
    puppet.manifest_file = "site.pp"
    puppet.options = ["--verbose", "--hiera_config /vagrant/puppet/hiera.yaml", "--parser future"]
    end
    end
    end
    10 changes: 10 additions & 0 deletions site.pp
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    Exec { 'github-accesstoken':
    command => "git config --global github.accesstoken '$github_accesstoken'",
    unless => "test `git config --global github.accesstoken` = '$github_accesstoken'",
    onlyif => "test -n '$github_accesstoken'",
    before => Composer::Exec['composer-install'],
    require => Package['git'],
    user => 'vagrant',
    environment => "HOME=/home/vagrant",
    path => "/usr/bin",
    }