0

I have these definitions for my puppet nodes:

Nginx node:

node 'nginx.XXXXXXXX.org' {
  package {"epel-release":
    ensure => "installed",
  }
  package {"nginx":
    ensure => "installed",
  }
  file {lookup("web_dirs"):
    ensure => "directory",
  }
}

Mongodb node:

node 'mongodb.XXXXXXXX.org' {
  package { 'mongodb':
    ensure => 'installed',
  }
  service {'mongodb':
    ensure => 'running',
    enable => true,
  }
  file { '/tmp/create_admin.js':
    content => epp('/etc/puppetlabs/code/environments/production/templates/create_admin.js.epp')
  }
  exec { 'Create the admin user':
    command => "/usr/bin/mongo < /tmp/create_admin.js && touch /home/vagrant/db_admin_created",
    creates  => "/home/vagrant/db_admin_created",
  }
  file { '/etc/mongodb.conf':
    source => "/etc/puppetlabs/code/environments/production/files/mongodb.conf",
    notify => Service["mongodb"],
  }
  file { '/tmp/create_app_user.js':
    content => epp("/etc/puppetlabs/code/environments/production/templates/create_app_user.js")
  }
  exec { "Create the application user":
    command => inline_epp("/usr/bin/mongo -u <%= lookup('db_root_username') %> -p <%= lookup('db_root_password') %> --authenticationDatabase admin < /tmp/create_app_user.js && touch /home/vagrant/db_user_created"),
    creates => "/home/vagrant/db_user_created",
  }
  exec { "Removes the JS script files":
    command => "/bin/rm -rf /tmp/create_admin.js /tmp/create_app_user.js",
  }
}

node default {
  notify { 'This node did not match any of the listed definitions':}
}

Node node:

node 'node.XXXXXXXX.org' {
  package {"epel-release":
    ensure => "installed",
  }
  package {"nodejs":
    ensure => "installed",
  }
  package {"npm":
    ensure => "installed",
  }
  file { lookup('app_dir'):
    ensure   => "directory",
    source   => "/etc/puppetlabs/code/environments/production/files/appfiles/",
    recurse => true
  }
  exec { "Run npm against package.json":
    command => "/usr/bin/npm install",
    cwd     => lookup("app_dir"),
  }
  file {"${lookup('app_dir')}/server.js":
    content => epp("/etc/puppetlabs/code/environments/production/templates/server.js.epp"),
    mode    => "0755"
  }
  file {"/etc/systemd/system/node.service":
    content => epp("/etc/puppetlabs/code/environments/production/templates/node.service.epp"),
  }
  service {"node":
    ensure => "running",
    enable => true,
  }
}

I have setup a workflow where the master puppet node called puppet host's a git repo from which these three pull manifest configs and apply them locally. Out of all the three nodes the Nginx node produces the following error when I apply a manifest change:

Notice: Compiled catalog for nginx.mshome.net in environment production in 0.03 seconds
Notice: This node did not match any of the listed definitions
Notice: /Stage[main]/Main/Node[default]/Notify[This node did not match any of the listed definitions]/message: defined 'message' as 'This node did not match any of the listed definitions'
Notice: Applied catalog in 0.02 seconds

I have looked at my definitions and I can't seem to find what is off about the nginx node, any pointers would be appreciated. Also note these machines were created using vagrant.

1 Answer 1

0

You should check the certname of your nginx host, and make sure it matches the name passed to the node block.

You can find out the certname by running the following command on the nginx host.

puppet config print certname

From what you describe, the certname does not match: one ends in ".net", the other ends in ".org"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.