Why is my vm vagabond puppet agent not connecting to my vm puppet master?

My goal is to have one or two nodes and one puppeteer. I used a bash script to provide each node with a puppetlabs repository and install the latest puppet and / or puppet master. But every time I try to run puppet agent --test in node, it returns this error:

 root@vm :~# puppet agent --test Error: Could not request certificate: Connection refused - connect(2) Exiting; failed to retrieve certificate and waitforcert is disabled 
  • I confirmed that the puppeteer is working.
  • I don't turn on node until the wizard gets up.
  • Running puppet cert list does not display any certificates awaiting the approval of the puppet master.
  • My / etc / hosts files have the correct IP addresses and hostnames.
  • /etc/puppet/puppet.conf looks right.
  • I can do a ping node from the wizard and vice versa.
  • iptables --list no firewall rules are displayed.

Unless Vagrant / Virtualbox can understand how to deal with port 8140? The error says “connection refused”, so I thought it was a firewall problem. But there is no firewall ...

So where did I mess up?

Here is my Vagrantfile:

 Vagrant.configure("2") do |config| config.vm.define :puppetmaster do |puppetmaster| puppetmaster.vm.box = "ubuntu-server-12042-x64-vbox4210-nocm" puppetmaster.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box" puppetmaster.vm.network :private_network, ip: "192.168.77.1" #puppetmaster.vm.network :forwarded_port, guest: 80, host: 20001 #puppetmaster.vm.network :forwarded_port, guest: 443, host: 24431 #puppetmaster.vm.network :forwarded_port, guest: 22, host: 20022 puppetmaster.vm.hostname = "vm.puppetmaster.lab" puppetmaster.vm.provision :shell, :path => "master-bootstrap.sh" puppetmaster.vm.synced_folder "modules/", "/etc/puppet/modules" puppetmaster.vm.synced_folder "manifests/", "/etc/puppet/manifests" end config.vm.define :alpha do |alpha| alpha.vm.box = "ubuntu-server-12042-x64-vbox4210-nocm" alpha.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box" alpha.vm.network :private_network, ip: "192.168.77.2" #alpha.vm.network :forwarded_port, guest: 22, host: 20023 alpha.vm.hostname = "vm.alpha.lab" alpha.vm.provision :shell, :path => "alpha-bootstrap.sh" end config.vm.define :beta do |beta| beta.vm.box = "ubuntu-server-12042-x64-vbox4210-nocm" beta.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box" beta.vm.network :private_network, ip: "192.168.77.3" #beta.vm.network :forwarded_port, guest: 22, host: 20024 beta.vm.hostname = "vm.beta.lab" beta.vm.provision :shell, :path => "beta-bootstrap.sh" end end 

My node bootstrap bash script:

 #!/usr/bin/env bash wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb dpkg -i puppetlabs-release-precise.deb apt-get update #apt-get -y dist-upgrade apt-get -y install puppet echo '192.168.77.1 vm.puppetmaster.lab' >> /etc/hosts echo '[agent]' >> /etc/puppet/puppet.conf echo 'server=vm.puppetmaster.lab' >> /etc/puppet/puppet.conf echo 'certname=vm.alpha.lab' >> /etc/puppet/puppet.conf 

My workshop loading a bash script:

 #!/usr/bin/env bash wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb dpkg -i puppetlabs-release-precise.deb apt-get update #apt-get -y dist-upgrade apt-get -y install puppet puppet apply /etc/puppet/manifests/default.pp 

Please note that I am using a slightly modified puppet module from Pro Puppet to set up / install the puppet / puppeteer. So I run the puppet apply in the bootstrap script.

Edit I can get two vm messages if I use: public_network and let my dhcp server jobs assign IP addresses. “Of course, this is not ideal, as it means that I can’t just use the address 192.xxx in a private local virtual network. I need to configure the host files manually before starting any puppets. But at least I know the problem is with using: private_network.

Edit 2 I just tried using the puppet / firewall module to make the 8140 open on the puppetmaster vm firewall, just in case I was missing something when I used to check the firewall. This allowed me to run a puppet on this vm. But when I tried to use alpha vm, it had the same connection as the error. Therefore, I doubt that the firewall has anything to do with it.

Edit 3 The private network option installs a second network card in the virtual machine. The first network adapter is NAT'd, the second is that it receives the static IP address that I assign.

Puppet plays on both network adapters. (At least as far as I can tell.)

The 192.xxx ip addresses are unique to these virtual machines. This range is not used anywhere else.

+7
source share
3 answers

Search for ifconfig in your host. Maybe ip 192.168.77.1 is your host address for a private network with a virtual machine. Change the ip of the puppet master VM, destroy it and start it.

+2
source

I am new to puppet. I just ran it a few hours ago.

The refused part of the connection means that the agent cannot find your puppet master. This means one of several things:

  • The server to which it connects is incorrect. You can use --server whatever.your.server.is to force it if you think this is a problem.
  • The macro processor is not running on the server. If you think this is a problem, you can try running netstat -an | grep "LISTEN" on the server and see if you see that port 8140 is working.
  • There is a connection problem between the field, for example, a firewall. Try pinging box or try telnetting to this port using "telnet whatever.your.server.is 8140". If it connects, this is not a problem.

Perhaps this is one of three.

+1
source

I had the same problem until I realized that the IP address assigned to me on the main server was already taken, and all the time I tried to connect to the wrong machine. but you probably checked that already, right?

0
source

All Articles