![]() If touch (new in 1.4), an empty file will be created if the file 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). If link, the symbolic link will be created or changed. If hard, the hard link will be created or changed. ![]() Set to touch or use the or module if you want to create the file if it does not exist. If file, even with other options (such as mode), the file will be modified if it exists but will NOT be created if it does not exist. If file, with no other options, returns the current state of path. Since Ansible 1.7 they will be created with the supplied permissions. If directory, all intermediate subdirectories will be created if they do not exist. Note that absent will not cause file to fail if the path does not exist as the state did not change. In the case of a directory, if diff is declared, you will see the files and folders deleted listed under path_contents. If absent, directories will be recursively deleted, and files or symlinks will be unlinked. Specifying mode is the best way to ensure filesystem objects are created with the correct permissions. If mode is not specified and the destination filesystem object does exist, the mode of the existing filesystem object will be used. If mode is not specified and the destination filesystem object does not exist, the default umask on the system will be used when setting the mode for the newly created filesystem object. Giving Ansible a number without following one of these rules will end up with a decimal number which will have unexpected results.Īs of Ansible 1.8, the mode may be specified as a symbolic mode (for example, u+rwx or u=rw,g=r,o=r). You must either add a leading zero so that Ansible’s YAML parser knows it is an octal number (like 0644 or 01777) or quote it (like '644' or '1777') so Ansible receives a string and can do its own conversion from string into number. The permissions the resulting filesystem object should have.įor those used to /usr/bin/chmod remember that modes are actually octal numbers.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |