84 lines
No EOL
6 KiB
HTML
84 lines
No EOL
6 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>cdist-type__file(7)</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /></head><body><div xml:lang="en" class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a id="idm140666318693280"></a>cdist-type__file(7)</h2></div><div><div class="author"><h3 class="author"><span class="firstname">Nico</span> <span class="surname">Schottelius</span></h3><code class="email"><<a class="email" href="mailto:nico-cdist--@--schottelius.org">nico-cdist--@--schottelius.org</a>></code></div></div></div><hr /></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="section"><a href="#_name">1. NAME</a></span></dt><dt><span class="section"><a href="#_description">2. DESCRIPTION</a></span></dt><dt><span class="section"><a href="#_required_parameters">3. REQUIRED PARAMETERS</a></span></dt><dt><span class="section"><a href="#_optional_parameters">4. OPTIONAL PARAMETERS</a></span></dt><dt><span class="section"><a href="#_messages">5. MESSAGES</a></span></dt><dt><span class="section"><a href="#_examples">6. EXAMPLES</a></span></dt><dt><span class="section"><a href="#_see_also">7. SEE ALSO</a></span></dt><dt><span class="section"><a href="#_copying">8. COPYING</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_name"></a>1. NAME</h2></div></div></div><p>cdist-type__file - Manage files</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_description"></a>2. DESCRIPTION</h2></div></div></div><p>This cdist type allows you to create files, remove files and set file
|
||
attributes on the target.</p><p>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</p><p>In any case, make sure that the file attributes are as specified.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_required_parameters"></a>3. REQUIRED PARAMETERS</h2></div></div></div><p>None.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_optional_parameters"></a>4. OPTIONAL PARAMETERS</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
|
||
state
|
||
</span></dt><dd>
|
||
<span class="emphasis"><em>present</em></span>, <span class="emphasis"><em>absent</em></span> or <span class="emphasis"><em>exists</em></span>, defaults to <span class="emphasis"><em>present</em></span>
|
||
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
|
||
</dd><dt><span class="term">
|
||
group
|
||
</span></dt><dd>
|
||
Group to chgrp to.
|
||
</dd><dt><span class="term">
|
||
mode
|
||
</span></dt><dd>
|
||
Unix permissions, suitable for chmod.
|
||
</dd><dt><span class="term">
|
||
owner
|
||
</span></dt><dd>
|
||
User to chown to.
|
||
</dd><dt><span class="term">
|
||
source
|
||
</span></dt><dd>
|
||
If supplied, copy this file from the host running cdist to the target.
|
||
If not supplied, an empty file or directory will be created.
|
||
If source is <span class="emphasis"><em>-</em></span> (dash), take what was written to stdin as the file content.
|
||
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_messages"></a>5. MESSAGES</h2></div></div></div><div class="variablelist"><dl class="variablelist"><dt><span class="term">
|
||
chgrp <group>
|
||
</span></dt><dd>
|
||
Changed group membership
|
||
</dd><dt><span class="term">
|
||
chown <owner>
|
||
</span></dt><dd>
|
||
Changed owner
|
||
</dd><dt><span class="term">
|
||
chmod <mode>
|
||
</span></dt><dd>
|
||
Changed mode
|
||
</dd><dt><span class="term">
|
||
create
|
||
</span></dt><dd>
|
||
Empty file was created (no --source specified)
|
||
</dd><dt><span class="term">
|
||
remove
|
||
</span></dt><dd>
|
||
File exists, but state is absent, file will be removed by generated code.
|
||
</dd><dt><span class="term">
|
||
upload
|
||
</span></dt><dd>
|
||
File was uploaded
|
||
</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_examples"></a>6. EXAMPLES</h2></div></div></div><pre class="screen"># Create /etc/cdist-configured as an empty file
|
||
__file /etc/cdist-configured
|
||
# The same thing
|
||
__file /etc/cdist-configured --state present
|
||
# Delete existing file
|
||
__file /etc/cdist-configured --state absent
|
||
|
||
# Use __file from another type
|
||
__file /etc/issue --source "$__type/files/archlinux" --state present
|
||
|
||
# Supply some more settings
|
||
__file /etc/shadow --source "$__type/files/shadow" \
|
||
--owner root --group shadow --mode 0640 \
|
||
--state present
|
||
|
||
# Provide a default file, but let the user change it
|
||
__file /home/frodo/.bashrc --source "/etc/skel/.bashrc" \
|
||
--state exists \
|
||
--owner frodo --mode 0600
|
||
|
||
# Take file content from stdin
|
||
__file /tmp/whatever --owner root --group root --mode 644 --source - << DONE
|
||
Here goes the content for /tmp/whatever
|
||
DONE</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_see_also"></a>7. SEE ALSO</h2></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
|
||
cdist-type(7)
|
||
</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="_copying"></a>8. COPYING</h2></div></div></div><p>Copyright (C) 2011-2013 Nico Schottelius. Free use of this software is
|
||
granted under the terms of the GNU General Public License version 3 (GPLv3).</p></div></div></body></html> |