Class: Ansible::Ruby::Modules::File
- Inherits:
-
Base
- Object
- Ansible::Ruby::Models::Base
- Base
- Ansible::Ruby::Modules::File
- Includes:
- Helpers::FileAttributes
- Defined in:
- lib/ansible/ruby/modules/generated/files/file.rb,
lib/ansible/ruby/modules/custom/files/file.rb
Overview
Sets attributes of files, symlinks, and directories, or removes files/symlinks/directories. Many other modules support the same options as the C(file) module - including M(copy), M(template), and M(assemble). For Windows targets, use the M(win_file) module instead.
Instance Method Summary collapse
-
#access_time ⇒ String?
This parameter indicates the time the file’s access time should be set to,Should be C(preserve) when no modification is required, C(YYYYMMDDHHMM.SS) when using default time format, or C(now),Default is None meaning that C(preserve) is the default for C(state=) and C(now) is default for C(state=touch).
-
#access_time_format ⇒ String?
When used with C(access_time), indicates the time format that must be used.,Based on default Python format (see time.strftime doc).
-
#follow ⇒ :yes, ...
This flag indicates that filesystem links, if they exist, should be followed.,Previous to Ansible 2.5, this was C(no) by default.
-
#force ⇒ :yes, ...
Force the creation of the symlinks in two cases: the source file does not exist (but will appear later); the destination exists and is a file (so, we need to unlink the “path” file and create symlink to the “src” file in place of it).
-
#modification_time ⇒ String?
This parameter indicates the time the file’s modification time should be set to,Should be C(preserve) when no modification is required, C(YYYYMMDDHHMM.SS) when using default time format, or C(now),Default is None meaning that C(preserve) is the default for C(state=) and C(now) is default for C(state=touch).
-
#modification_time_format ⇒ String?
When used with C(modification_time), indicates the time format that must be used.,Based on default Python format (see time.strftime doc).
-
#path ⇒ String
Path to the file being managed.
-
#recurse ⇒ :yes, ...
Recursively set the specified file attributes (applies only to directories).
-
#src ⇒ String?
Path of the file to link to (applies only to C(state=link) and C(state=hard)).
-
#state ⇒ :absent, ...
If C(directory), all intermediate subdirectories will be created if they do not exist.
Methods included from Helpers::FileAttributes
Methods inherited from Base
Methods inherited from Ansible::Ruby::Models::Base
attr_option, attr_options, attribute, fix_inclusion, #initialize, remove_existing_validations, #to_h, validates
Constructor Details
This class inherits a constructor from Ansible::Ruby::Models::Base
Instance Method Details
#access_time ⇒ String?
Returns This parameter indicates the time the file’s access time should be set to,Should be C(preserve) when no modification is required, C(YYYYMMDDHHMM.SS) when using default time format, or C(now),Default is None meaning that C(preserve) is the default for C(state=) and C(now) is default for C(state=touch).
45 |
# File 'lib/ansible/ruby/modules/generated/files/file.rb', line 45 attribute :access_time |
#access_time_format ⇒ String?
Returns When used with C(access_time), indicates the time format that must be used.,Based on default Python format (see time.strftime doc).
49 |
# File 'lib/ansible/ruby/modules/generated/files/file.rb', line 49 attribute :access_time_format |
#follow ⇒ :yes, ...
Returns This flag indicates that filesystem links, if they exist, should be followed.,Previous to Ansible 2.5, this was C(no) by default.
33 |
# File 'lib/ansible/ruby/modules/generated/files/file.rb', line 33 attribute :follow |
#force ⇒ :yes, ...
Returns force the creation of the symlinks in two cases: the source file does not exist (but will appear later); the destination exists and is a file (so, we need to unlink the “path” file and create symlink to the “src” file in place of it).
29 |
# File 'lib/ansible/ruby/modules/generated/files/file.rb', line 29 attribute :force |
#modification_time ⇒ String?
Returns This parameter indicates the time the file’s modification time should be set to,Should be C(preserve) when no modification is required, C(YYYYMMDDHHMM.SS) when using default time format, or C(now),Default is None meaning that C(preserve) is the default for C(state=) and C(now) is default for C(state=touch).
37 |
# File 'lib/ansible/ruby/modules/generated/files/file.rb', line 37 attribute :modification_time |
#modification_time_format ⇒ String?
Returns When used with C(modification_time), indicates the time format that must be used.,Based on default Python format (see time.strftime doc).
41 |
# File 'lib/ansible/ruby/modules/generated/files/file.rb', line 41 attribute :modification_time_format |
#path ⇒ String
Returns Path to the file being managed.
13 |
# File 'lib/ansible/ruby/modules/generated/files/file.rb', line 13 attribute :path |
#recurse ⇒ :yes, ...
Returns recursively set the specified file attributes (applies only to directories).
25 |
# File 'lib/ansible/ruby/modules/generated/files/file.rb', line 25 attribute :recurse |
#src ⇒ String?
Returns path of the file to link to (applies only to C(state=link) and C(state=hard)). Will accept absolute, relative and nonexisting paths. Relative paths are relative to the file being created (C(path)) which is how the UNIX command C(ln -s SRC DEST) treats relative paths.
21 |
# File 'lib/ansible/ruby/modules/generated/files/file.rb', line 21 attribute :src |
#state ⇒ :absent, ...
Returns If C(directory), all intermediate subdirectories will be created if they do not exist. Since Ansible 1.7 they will be created with the supplied permissions. If C(file), the file will NOT be created if it does not exist; see the C(touch) value or the M(copy) or M(template) module if you want that behavior. If C(link), the symbolic link will be created or changed. Use C(hard) for hardlinks. If C(absent), directories will be recursively deleted, and files or symlinks will be unlinked. Note that C(absent) will not cause C(file) to fail if the C(path) does not exist as the state did not change. If C(touch) (new in 1.4), an empty file will be created if the C(path) does not exist, while an existing file or directory will receive updated file access and modification times (similar to the way ‘touch` works from the command line).
17 |
# File 'lib/ansible/ruby/modules/generated/files/file.rb', line 17 attribute :state |