Cannot add rancher agent to rancher ssl server

I have followed the setup instructions for SSL and have a rancher server available (can setup authentication, etc).

I went to add a rancher agent to the same box as the rancher-server using the following command:

sudo docker run -e CATTLE_HOST_LABELS='master=true' -d --privileged -v /var/run/docker.sock:/var/run/docker.sock --name=rancher-agent rancher/agent:v0.7.9 http://localhost:8080/v1/scripts/#{REDACTED_TOKEN}

The agent starts up fine and produces:

INFO: docker info: No Proxy:
INFO: Attempting to connect to: http://10.53.3.154:8080/v1
INFO: http://10.53.3.154:8080/v1 is accessible
INFO: Inspecting host capabilities
INFO: System: true
INFO: Host writable: true
INFO: Token: xxxxxxxx
INFO: Running registration
Traceback (most recent call last):
File “./register.py”, line 11, in
secret_key=os.environ[‘CATTLE_REGISTRATION_SECRET_KEY’])
File “/usr/local/lib/python2.7/dist-packages/cattle.py”, line 34, in from_env
return gdapi.from_env(prefix=prefix, factory=Client, **kw)
File “/usr/local/lib/python2.7/dist-packages/gdapi.py”, line 604, in from_env
return _from_env(prefix=prefix, factory=factory, **args)
File “/usr/local/lib/python2.7/dist-packages/gdapi.py”, line 623, in _from_env
return factory(**result)
File “/usr/local/lib/python2.7/dist-packages/cattle.py”, line 12, in init
super(Client, self).init(*args, **kw)
File “/usr/local/lib/python2.7/dist-packages/gdapi.py”, line 195, in init
self._load_schemas()
File “/usr/local/lib/python2.7/dist-packages/gdapi.py”, line 309, in _load_schemas
response = self._get_response(self._url)
File “/usr/local/lib/python2.7/dist-packages/gdapi.py”, line 258, in _get_response
headers=self._headers)
File “/usr/local/lib/python2.7/dist-packages/requests/sessions.py”, line 477, in get
return self.request(‘GET’, url, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/requests/sessions.py”, line 465, in request
resp = self.send(prep, **send_kwargs)
File “/usr/local/lib/python2.7/dist-packages/requests/sessions.py”, line 573, in send
r = adapter.send(request, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/requests/adapters.py”, line 415, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: (‘Connection aborted.’, error(110, ‘Connection timed out’))

The error takes a long time to show up. When I look at the server logs I see this block repeating and repeating:

time=“2015-07-09T02:13:14Z” level=info msg=“Exiting go-machine-service…”
time=“2015-07-09T02:13:16Z” level=info msg=“Setting log level” logLevel=info
time=“2015-07-09T02:13:16Z” level=info msg=“Starting go-machine-service…” gitcommit=“9320efc”
time=“2015-07-09T02:13:46Z” level=error msg=“Unable to create EventRouter” Err=“Get http://#{redacted_external_host_name}/v1: dial tcp #{redacted_external_ip}:80: i/o timeout”

Adding the same host that is running rancher/server requires an extra environment variable…

http://rancher.docs.rancher.com/docs/infrastructure/hosts/custom/#samehost

Thank you! was able to figure this one out.