nickschuch/puppet-rancher

Not working correctly when applying both on a server

thbeh opened this issue · 6 comments

thbeh commented

Hi, I have been testing on Vagrant and setting up was a breeze. While it works very well on the example Vagrantfile provided but when I am try to apply both management and node on the same server, somehow the agent keep upgrading when i docker logs into the agent. Here's how I created the tasks -

  1. created a management.pp in modules/rancher/manifests
  2. In site.pp, I put as -
    include management

default node {
docker::image { 'rancher/agent':
require => Package['docker'],
}

docker::run { 'rancher_node':
image => 'rancher/agent',
command => "http://${management}:8080",
volumes => '/var/run/docker.sock:/var/run/docker.sock',
require => Docker::Image['rancher/agent'],
}
}

the agent keeps upgrading and creating new agent container

ee142f723da81f374cfe4bf5876a214d9bfb595908c8c47ff5bbc581dbba8d58
INFO: Starting agent for 7561090A5227A92EFEBF
INFO: Access Key: 7561090A5227A92EFEBF
INFO: Config URL: http://192.168.20.112:8080/v1
INFO: Storage URL: http://192.168.20.112:8080/v1
INFO: API URL: http://192.168.20.112:8080/v1
INFO: IP: 172.17.0.1
INFO: Port:
INFO: Required Image: rancher/agent:v0.8.2
INFO: Current Image: rancher/agent
INFO: Upgrading to image rancher/agent:v0.8.2
rancher-agent-upgrade
aa5ec82aa8750d0b83bedb7a492679363628bbb2ab4f1448cca7b7e6b153c713
INFO: Starting agent for 7561090A5227A92EFEBF
INFO: Access Key: 7561090A5227A92EFEBF
INFO: Config URL: http://192.168.20.112:8080/v1
INFO: Storage URL: http://192.168.20.112:8080/v1
INFO: API URL: http://192.168.20.112:8080/v1
INFO: IP: 172.17.0.1
INFO: Port:
INFO: Required Image: rancher/agent:v0.8.2
INFO: Current Image: rancher/agent
INFO: Upgrading to image rancher/agent:v0.8.2

Ah, I think this is the key:

INFO: Required Image: rancher/agent:v0.8.2
INFO: Current Image: rancher/agent
INFO: Upgrading to image rancher/agent:v0.8.2

What happens if you update your code to:

$image = 'rancher/agent:v0.8.2'

default node {
  docker::image { $image:
    require => Package['docker'],
  }
}

docker::run { 'rancher_node':
  image       => $image,
  command => "http://${management}:8080",
  volumes   => '/var/run/docker.sock:/var/run/docker.sock',
  require     => Docker::Image[$image],
}

In this code I pushed it to a variable and locked in the specific version of the agent.

thbeh commented

Another thing was that, somehow the agent always get run/installed before server. Could I put '->' for the ordering?

You could put another require in there eg.

require     => [
  Docker::Image[$image],
  Docker::Run['rancher_server'],
],

That should respect that the servers definition is in place first.

thbeh commented

It's working good now with the following (some how it was complaining of an
array issue on 'require' line, so I have put a 'depends' option)

include rancher::management

$image = 'rancher/agent:v0.8.2'

node default {
docker::image { $image:
}

docker::run { 'rancher_node':
image => $image,
command => "http://$::ipaddress_eth0:8080",
volumes => '/var/run/docker.sock:/var/run/docker.sock',
require => Docker::Image[$image],
depends => ['rancher_server'],
}
}

Thanks for al the help

On Wed, Dec 16, 2015 at 4:28 PM, Nick Schuch notifications@github.com
wrote:

You could put another require in there eg.

require => [
Docker::Image[$image],
Docker::Run['rancher_server'],
],

That should respect that the servers definition is in place first.


Reply to this email directly or view it on GitHub
#4 (comment)
.

No worries! Happy for me to close this issue?

thbeh commented

Yup.

On Fri, Dec 18, 2015 at 11:46 AM, Nick Schuch notifications@github.com
wrote:

No worries! Happy for me to close this issue?


Reply to this email directly or view it on GitHub
#4 (comment)
.