Hi,

I am trying to build (on node A) an authorized_keys file that contains
all host keys from all nodes that have class C imported. Here is my
code:

class C {
        @@file { "/var/lib/foo/authorized_keys/$fqdn":
                ensure => present,
                content => "from=\"$ipaddress_eth0\" ssh-rsa $sshrsakey\n",
                tag => "foo",
        }
}

node A {
        class { 'bar': }
}

class bar {
        File <<| tag == 'foo' |>> {
                notify => Exec["/home/bar/.ssh/authorized_keys"],
        }
        
        exec { "/home/bar/.ssh/authorized_keys":
                        command => "cat /var/lib/foo/authorized_keys/* > 
/home/bar/.ssh/authorized_keys"
                        path => "/bin:/usr/bin",
                        provider => shell,
        }
}

This works.

I would, however, prefer to have the exec subscribed to the File
instead of notifying the exec from the File. I would like to write

class bar {
        File <<| tag == 'foo' |>>
        
        exec { "/home/bar/.ssh/authorized_keys":
                        command => "cat /var/lib/foo/authorized_keys/* > 
/home/bar/.ssh/authorized_keys"
                        path => "/bin:/usr/bin",
                        provider => shell,
                        subscribe => File <<| tag == 'foo' |>>,
        }
}

which doesn't compile.

How can I refer to the File in my exec?


That being said, is there a way to do things more elegantly? I
understand that I need to create one file by node of class C, or is
there a way to have the exported resources all concatenated into the
same file?

Any hints will be appreciated.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 31958061
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 31958062

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to