ansible file模組使用方法

2022-07-18 06:21:15 字數 505 閱讀 9415

管理遠端主機檔案,建立檔案或目錄,刪除檔案或目錄,修改檔案或目錄的許可權等

在/opt目錄下建立test目錄,並在/opt/test目錄下建立test01檔案,屬主屬組為test,許可權644

]# ansible all -m file -a 'path=/opt/test state=directory'

]# ansible all -m file -a 'path=/opt/test/test01 state=touch'

]# ansible all -m file -a 'path=/opt/test/test01 owner=test group=test mode=644'

為/opt/test/test01檔案建立軟鏈結,軟鏈結名ltest01

]# ansible all -m file -a 'path=/opt/test/ltest01 state=link src=/opt/test/test01'

Python使用模組Pyserial模組報

用pip安裝pyserial後 sudo h pip install pyserial,執行新建的程式,名稱為serial.py,程式中用到 import serial.toos.list ports,但總是提示importerror no module named tools.list ports...

python os模組使用

os.sep 可以取代作業系統 特定的路徑分割符 os.linesep 字串給出當前平台使用的行終止符。例如,windows使用 r n linux使用 n 而mac使用 r os.name 字串指示你正在使用的平台。比如對於windows,它是 nt 而對於linux unix使用者,它是 pos...

Httplib模組使用

httplib是乙個相對底層的http請求模組,其上有專門的包裝模組,如urllib內建模組,goto等第三方模組,但是封裝的越高就越不靈活,比如urllib模組裡請求錯誤時就不會返回結果頁的內容,只有頭資訊,對於某些需要檢測錯誤請求返回值的場景就不適用,所以就得用這個模組了。vrequest se...