saltstack模塊之file相關模塊
1、file.access模塊
file.access:測試salt進程是否有對指定文件的對應訪問權限。
[[email protected] ~]# salt ‘*‘ file.access /etc/passwd f salt-minion02.contoso.com: True salt-minion01.contoso.com: True [[email protected] ~]# salt ‘*‘ file.access /etc/passwd r salt-minion02.contoso.com: True salt-minion01.contoso.com: True [[email protected]
2、file.touch模塊
file.touch:如果文件不存在創建文件,相當於touch file,如果文件存在就更新訪問時間或者修改時間。
[[email protected] ~]# salt ‘*‘ file.touch /tmp/salt-test salt-minion02.contoso.com: True salt-minion01.contoso.com: True
3、file.append模塊
file.append:追加文字到文件的末尾。
[[email protected] ~]# salt ‘*‘ file.append /tmp/sal-test "Hello,World." salt-minion01.contoso.com: Wrote 1 lines to "/tmp/sal-test" salt-minion02.contoso.com: Wrote 1 lines to "/tmp/sal-test" [[email protected]