Moving a file with Puppet

3,794 views
Skip to first unread message

Leah

unread,
Nov 13, 2008, 10:06:05 AM11/13/08
to Puppet Users
I wanted to move a file from one directory to another because my co-
worker didn't like where it was being put by puppet. I went into
puppet and changed the name parameter of the the file directive. I
then created a new file directive to delete the old file, but I was
wondering if there was a better way to do this.

So, just to clarify, I went from:

file {"myfile":
name => "/root/myfile",
...
}

to:

file {"myfile":
name => "/newdirectory/myfile",
...
}

file {"deleteoldlocationofmyfile":
name => "/root/myfile",
ensure => absent,
}

I just feel like moving the location of a file will cause bloat of
configurations in puppet, but maybe I'm missing some great parameter.

Thanks,

Leah

Evan Hisey

unread,
Nov 13, 2008, 12:51:31 PM11/13/08
to puppet...@googlegroups.com
That is really about the way to do it. Don't for get that after it has
run for awhile and all teh clients have resynced to the new location
you can remove the code needed to delete the old location.

Evan

Andrew Shafer

unread,
Nov 13, 2008, 1:15:51 PM11/13/08
to puppet...@googlegroups.com

Moving a bunch of config files around like this is going to be clumsy without Puppet.

If you have to do this a lot you could parametrize a define, and I would get rid of the ensure => absent once the changes have propagated.

$0.02

Leah Fisher

unread,
Nov 13, 2008, 1:37:44 PM11/13/08
to puppet...@googlegroups.com
Thanks for the replies. I just wanted to verify there wasn't a better
way to do this. Hopefully it shouldn't happen very often.

Luke Kanies

unread,
Nov 13, 2008, 3:02:27 PM11/13/08
to puppet...@googlegroups.com
On Nov 13, 2008, at 7:06 AM, Leah wrote:

> I wanted to move a file from one directory to another because my co-
> worker didn't like where it was being put by puppet. I went into
> puppet and changed the name parameter of the the file directive. I
> then created a new file directive to delete the old file, but I was
> wondering if there was a better way to do this.


It'd be nice to have a generalized 'rename' parameter that allowed one
to rename resources, but it's been asked for so rarely (I think this
is actually the first time) that I've never actually put any time into
it.

At this point, the solution you've chosen is the most reasonable.

--
It has recently been discovered that research causes cancer in
labratory rats.
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com

Reply all
Reply to author
Forward
0 new messages