Unable to collect stored resources(ipaddress) in puppet

28 views
Skip to first unread message

Manjunatha T N

unread,
Dec 22, 2014, 9:22:40 AM12/22/14
to puppet...@googlegroups.com
Hi,

I am using Puppet master and client 3.7 and for store configs MySql DB. Here I am trying to export IPaddress from one node another. When I ran the agent in client node it is executing without any error, could see the  related node details in MYSQL db but not able collect it and mentioned file is showing as empty. Please find the below my classes details and puppet conf details. Please help me to fix this issue. Thanks in advance.
-------------------------------------------------------
class admin::file {
@@file {"/tmp/ip.txt/${::ipaddress}":
path => '/tmp/ip.txt/',
content => "\ndefine('DB_HOST',\t${::ipaddress});",
tag => "ip"
}
}

{
include admin::file
}

class admin { 
File <<| tag == 'ip" |>>
}

{
include admin
}
-------------------------------------------------

#/etc/puppet/puppet.conf
[master]
   dbadapter = mysql
   storeconfigs=true
   dbuser = puppet
   dbpassword = P@ssw0rd
   dbserver = puppetmaster.garuda.com
   dbsocket = /var/run/mysqld/mysqld.sock
----------------------------------------------------------------mysql> select * from hosts;
+----+------------------+--------------+-------------+---------------------+-----------------+-------------+---------------------+----------------+---------------------+
| id | name             | ip           | environment | last_compile        | last_freshcheck | last_report | updated_at          | source_file_id | created_at          |
+----+------------------+--------------+-------------+---------------------+-----------------+-------------+---------------------+----------------+---------------------+
|  1 | puppet.openstack | 10.100.1.188 | production  | 2014-12-22 23:57:30 | NULL            | NULL        | 2014-12-22 23:57:30 |           NULL | 2014-12-21 21:50:53 |
+----+------------------+--------------+-------------+---------------------+-----------------+-------------+---------------------+----------------+---------------------+
---


jcbollinger

unread,
Dec 23, 2014, 9:04:26 AM12/23/14
to puppet...@googlegroups.com


On Monday, December 22, 2014 8:22:40 AM UTC-6, Manjunatha T N wrote:
Hi,

I am using Puppet master and client 3.7 and for store configs MySql DB. Here I am trying to export IPaddress from one node another. When I ran the agent in client node it is executing without any error, could see the  related node details in MYSQL db but not able collect it and mentioned file is showing as empty. Please find the below my classes details and puppet conf details. Please help me to fix this issue. Thanks in advance.
-------------------------------------------------------

Looking at this code:
 
class admin::file {
@@file {"/tmp/ip.txt/${::ipaddress}":
path => '/tmp/ip.txt/',


there are a few strange things:
  • You do not specify an 'ensure' value.  It looks like you want ensure => 'file'.  This could be the source of your issue.
  • You use a path-like title but a different 'path' property.  That's not an error, but it's not very useful.  I'm inclined to think that you expect different behavior to result from this than you actually will get.
  • The value of the 'path' property ends with a '/' character.  That's a semantic error (but not a syntax error).  The master is unlikely to complain about it, but it's unclear whet the effect will be at the agent.
 
content => "\ndefine('DB_HOST',\t${::ipaddress});",
tag => "ip"
}
}

{
include admin::file
}

class admin { 
File <<| tag == 'ip" |>>
}


Also, you have mismatched quotes in your collector (above).  If that's the code actually appearing in your manifest set then the master should throw a parse error for any node that declares class 'admin'.  Depending on Puppet's configuration, the agent on such a node might in that case apply a cached catalog.  This also might explain your problem.


John

Reply all
Reply to author
Forward
0 new messages