2011-03-08 20:47:08 +00:00
|
|
|
cdist-type__file(7)
|
|
|
|
===================
|
2011-03-08 20:27:57 +00:00
|
|
|
Nico Schottelius <nico-cdist--@--schottelius.org>
|
|
|
|
|
|
|
|
|
|
|
|
NAME
|
|
|
|
----
|
2011-07-18 11:34:39 +00:00
|
|
|
cdist-type__file - Manage files
|
2011-03-08 20:27:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
2012-01-09 15:30:52 +00:00
|
|
|
This cdist type allows you to create files, remove files and set file
|
2011-07-18 11:34:39 +00:00
|
|
|
attributes on the target.
|
2011-03-08 20:27:57 +00:00
|
|
|
|
2013-09-12 12:02:33 +00:00
|
|
|
If the file already exists on the target, then if it is a:
|
|
|
|
- regular file, and state is:
|
|
|
|
present: replace it with the source file if they are not equal
|
|
|
|
exists: do nothing
|
|
|
|
- symlink: replace it with the source file
|
|
|
|
- directory: replace it with the source file
|
|
|
|
|
|
|
|
In any case, make sure that the file attributes are as specified.
|
|
|
|
|
2011-03-08 20:27:57 +00:00
|
|
|
|
2011-03-08 20:47:08 +00:00
|
|
|
REQUIRED PARAMETERS
|
2011-03-08 20:27:57 +00:00
|
|
|
-------------------
|
2011-03-15 20:13:01 +00:00
|
|
|
None.
|
2011-03-08 20:27:57 +00:00
|
|
|
|
2011-03-08 20:47:08 +00:00
|
|
|
OPTIONAL PARAMETERS
|
|
|
|
-------------------
|
2011-07-18 11:34:39 +00:00
|
|
|
state::
|
2012-04-03 22:08:23 +00:00
|
|
|
'present', 'absent' or 'exists', defaults to 'present'
|
|
|
|
where:
|
|
|
|
present: the file is exactly the one from source
|
|
|
|
absent: the file does not exist
|
|
|
|
exists: the file from source but only if it doesn't already exist
|
2011-07-18 11:34:39 +00:00
|
|
|
|
2011-03-14 23:05:38 +00:00
|
|
|
group::
|
|
|
|
Group to chgrp to.
|
|
|
|
|
2011-03-08 20:47:08 +00:00
|
|
|
mode::
|
|
|
|
Unix permissions, suitable for chmod.
|
2011-03-08 20:27:57 +00:00
|
|
|
|
2011-03-14 23:05:38 +00:00
|
|
|
owner::
|
|
|
|
User to chown to.
|
|
|
|
|
2011-03-08 20:47:08 +00:00
|
|
|
source::
|
|
|
|
If supplied, copy this file from the host running cdist to the target.
|
|
|
|
If not supplied, an empty file or directory will be created.
|
2012-06-04 12:17:42 +00:00
|
|
|
If source is '-' (dash), take what was written to stdin as the file content.
|
2011-03-08 20:27:57 +00:00
|
|
|
|
2013-11-26 00:01:44 +00:00
|
|
|
MESSAGES
|
|
|
|
--------
|
2013-12-03 14:41:43 +00:00
|
|
|
chgrp <group>::
|
|
|
|
Changed group membership
|
|
|
|
chown <owner>::
|
|
|
|
Changed owner
|
|
|
|
chmod <mode>::
|
|
|
|
Changed mode
|
|
|
|
create::
|
|
|
|
Empty file was created (no --source specified)
|
2013-11-26 00:01:44 +00:00
|
|
|
remove::
|
|
|
|
File exists, but state is absent, file will be removed by generated code.
|
2013-12-03 14:41:43 +00:00
|
|
|
upload::
|
|
|
|
File was uploaded
|
2013-11-26 00:01:44 +00:00
|
|
|
|
2011-03-08 20:27:57 +00:00
|
|
|
|
2011-03-08 20:47:08 +00:00
|
|
|
EXAMPLES
|
|
|
|
--------
|
2011-03-08 20:27:57 +00:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
2011-03-08 20:47:08 +00:00
|
|
|
# Create /etc/cdist-configured as an empty file
|
2011-03-16 07:45:01 +00:00
|
|
|
__file /etc/cdist-configured
|
2011-07-18 11:34:39 +00:00
|
|
|
# The same thing
|
2012-01-09 14:41:15 +00:00
|
|
|
__file /etc/cdist-configured --state present
|
2011-07-18 11:34:39 +00:00
|
|
|
# Delete existing file
|
2012-01-09 14:41:15 +00:00
|
|
|
__file /etc/cdist-configured --state absent
|
2011-03-08 20:27:57 +00:00
|
|
|
|
2011-03-08 20:47:08 +00:00
|
|
|
# Use __file from another type
|
2012-01-09 14:41:15 +00:00
|
|
|
__file /etc/issue --source "$__type/files/archlinux" --state present
|
2011-03-14 23:05:38 +00:00
|
|
|
|
|
|
|
# Supply some more settings
|
2011-03-16 07:45:01 +00:00
|
|
|
__file /etc/shadow --source "$__type/files/shadow" \
|
2011-07-18 11:34:39 +00:00
|
|
|
--owner root --group shadow --mode 0640 \
|
2012-01-09 14:41:15 +00:00
|
|
|
--state present
|
2012-04-04 07:37:18 +00:00
|
|
|
|
|
|
|
# Provide a default file, but let the user change it
|
|
|
|
__file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \
|
|
|
|
--state exists \
|
|
|
|
--owner frodo --mode 0600
|
2012-06-04 12:17:42 +00:00
|
|
|
|
|
|
|
# Take file content from stdin
|
|
|
|
__file /tmp/whatever --owner root --group root --mode 644 --source - << DONE
|
|
|
|
Here goes the content for /tmp/whatever
|
|
|
|
DONE
|
|
|
|
|
2011-03-08 20:27:57 +00:00
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
2011-03-08 20:47:08 +00:00
|
|
|
- cdist-type(7)
|
2011-03-08 20:27:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
COPYING
|
|
|
|
-------
|
2013-11-26 00:01:44 +00:00
|
|
|
Copyright \(C) 2011-2013 Nico Schottelius. Free use of this software is
|
2011-03-08 20:27:57 +00:00
|
|
|
granted under the terms of the GNU General Public License version 3 (GPLv3).
|