7

So basically my issue is very similar to this question:

Vagrant + Puppet: Unable to run composer install with private repository

I am trying to get composer to install deployed applications on a Ubuntu 12.04 box using puppet.

One of the packages I am trying to install as part of the composer run requires a deployment key. As part of the puppet run I have copied the deployment key (private, public and authorized and known_hosts) accross to the vagrant users home directory (/home/vagrant/.ssh/)

This is where my question differs from the referenced question in that security is not a concern nor is multiple OS compatability for this build so i am happy to copy the keys over to the box and I have done...

I have also loaded this key in the users .profile so that if I ssh into the machine I can run a composer install and everything runs just fine. The problem is i would like to have the apps install as part of the puppet run and I'm struggling to get this to work (everything installs until it gets to the one package which requires the deployment key).

My composer.json currently contains this (current attempt to get it working):

"repositories": [
        {
            "type": "vcs",
            "url": "ssh://git@bitbucket.org/account/subrepo.git",
            "options": {
                "ssh2": {
                    "username": "git",
                    "pubkey_file": "/home/vagrant/.ssh/key.pub",
                    "privkey_file": "/home/vagrant/.ssh/key"
                }
            }
        }
    ],

My puppet run pulls the repos from git using vcsrepo (which allows you to pass a key in):

vcsrepo { "/var/www/site.dev":
    require => [ File["/home/vagrant/.ssh/key"]  ],
    ensure   => present,
    owner    => vagrant,
    provider => git,
    source   => "ssh://git@bitbucket.org/account/site.git",
    revision => 'master',
    identity => '/home/vagrant/.ssh/key',
}

This part works fine but when I run the composer install as follows it dies when it hits the package referenced in the composer.json:

composer::exec { 'site-composer-run':
    cmd     => 'install',
    cwd     => '/var/www/site.dev',
    require => [
      Class['composer'],
      Vcsrepo["/var/www/site.dev"]
    ]
  }

I think what I need is a way of adding an ssh-key for a user without them being attached to a bash terminal, but I'm not too sure so I'm open to any and all suggestions at this point. Thanks in advance.

Jon
  • 3,573
  • 2
  • 17
  • 24
SwiftD
  • 5,769
  • 6
  • 43
  • 67

0 Answers0