Allows for setting attributes of file, symlinks, directories. Can be used to remove files.
def test_fun(duthosts, rand_one_dut_hostname):
duthost = duthosts[rand_one_dut_hostname]
delete_file = duthost.image_facts(path="/file/to/delete.txt", state='absent')
path
- path to file that should be modified- Required:
True
- Type:
String
- Required:
access_time
- what the files access time should be set to. Ifnow
is provided, current time is used- Required:
False
- Type:
String
- Format:
YYYYMMDDHHMM.SS
(default)
- Required:
access_time_format
- Format foraccess_time
- Required:
False
- Type:
String
- Default:
%Y%m%d%H%M.%S
- Required:
follow
- Whether symlinks should be followed- Required:
False
- Type:
Boolean
- Default:
True
- Required:
force
- Force creation of symlinks if source file does not exist or if the destination exists and is a file- Required:
False
- Type:
Boolean
- Default:
False
- Required:
group
- name of group that should on the file- Required:
False
- Type:
String
- Required:
mode
- permissions of resulting file- Required:
False
- Type:
String
- Format:
u=rw,g=r,o=r
- Required:
modification_time
- What the files mtime should be set to- Required:
False
- Type:
String
- Format:
YYYYMMDDHHMM.SS
(default)
- Required:
modification_time_format
- Format formodification_time
- Required:
False
- Type:
String
- Default:
%Y%m%d%H%M.%S
- Required:
owner
- Name of owner that hsould own the file- Required:
False
- Type:
String
- Required:
recurse
- Set attributes recursively on directory contents- Required:
False
- Type:
Boolean
- Default:
False
- Required:
selevel
- the level part of the Security Enchanced Linux file context- Required:
False
- Type:
String
- Required:
serole
- The role part of the Security Enchanced Linux file context- Required:
False
- Type:
String
- Required:
setype
- the type part of the Security Enchanced Linux file context- Required:
False
- Type:
String
- Required:
seuser
- the user part of the Security Enchanced Linux file context- Required:
False
- Type:
String
- Required:
src
- Path of file to link to (for links)- Required:
False
- Type:
String
- Required:
state
- What should be done to the file- Required:
False
- Type:
String
- Default:
file
- Choices:
absent
- file will be recursively deleteddirectory
- directory will be createdfile
- returns current state of file with modifications from other attributres. Will not create file if it does not exist.hard
- hard link will be created or changedlink
- symlink will be created or changedtouch
- an empty file will be created at the path specified
- Required:
unsafe_writes
- Whether ansible should be allowed to use unsafe write in the event that atomic operations do not work- Required:
False
- Type:
Boolean
- Default:
False
- Required:
Dictionary with basic information.
dest
- destination of pathpath
- destination of path