中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

如何ps做網(wǎng)站首頁(yè)寧波seo優(yōu)化項(xiàng)目

如何ps做網(wǎng)站首頁(yè),寧波seo優(yōu)化項(xiàng)目,做海淘的網(wǎng)站,wordpress 4.9 中文版華子目錄 Ansible四個(gè)命令模塊1.組成2.特點(diǎn)3.區(qū)別3.1command、shell模塊3.2raw模塊 4.command模塊4.1參數(shù)表4.2free_form參數(shù) 5.shell模塊5.1作用5.2例如 6.script模塊6.1示例 7.raw模塊7.1參數(shù)7.2示例 文件操作模塊1.file模塊1.1參數(shù)1.2示例 2.copy模塊2.1參數(shù) Ansible四個(gè)命令…

華子目錄

  • Ansible四個(gè)命令模塊
    • 1.組成
    • 2.特點(diǎn)
    • 3.區(qū)別
      • 3.1`command、shell`模塊
      • 3.2`raw`模塊
    • 4.`command`模塊
      • 4.1參數(shù)表
      • 4.2`free_form`參數(shù)
    • 5.`shell`模塊
      • 5.1作用
      • 5.2例如
    • 6.`script`模塊
      • 6.1示例
    • 7.`raw`模塊
      • 7.1參數(shù)
      • 7.2示例
  • 文件操作模塊
    • 1.`file`模塊
      • 1.1參數(shù)
      • 1.2示例
    • 2.copy模塊
      • 2.1參數(shù)

Ansible四個(gè)命令模塊

1.組成

  • command、shell、raw

2.特點(diǎn)

  • 應(yīng)盡量避免使用這三個(gè)模塊來(lái)執(zhí)行命令,因?yàn)槠渌K大部分都是冪等性的,可以自動(dòng)進(jìn)行更改跟蹤。
  • 冪等性輸入相同,輸出相同,無(wú)論多少次執(zhí)行。比如說(shuō)確認(rèn)接口,如果傳入訂單號(hào),返回確認(rèn)ok,如果已經(jīng)確認(rèn)過(guò)了,再次調(diào)用確認(rèn)接口,返回如果還是確認(rèn)ok,那么這個(gè)接口就是滿(mǎn)足冪等性
  • command、shell、raw不具備冪等性

3.區(qū)別

3.1command、shell模塊

  • 相同點(diǎn):要求受管主機(jī)上安裝python
  • 不同點(diǎn):command可以在受管主機(jī)上執(zhí)行Linux命令,但是不支持環(huán)境變量和操作符(例如'|' '<' '>' '&'),shell模塊需要調(diào)用/bin/sh指令執(zhí)行

3.2raw模塊

  • 不需要受管主機(jī)安裝python,直接使用遠(yuǎn)程shell運(yùn)行命令,通常用于無(wú)法安裝python的系統(tǒng)(例如:網(wǎng)絡(luò)設(shè)備等)

4.command模塊

4.1參數(shù)表

名稱(chēng)必選備注
chdirno(不是必選參數(shù))運(yùn)行command命令前先cd到這個(gè)目錄
createsno如果這個(gè)參數(shù)對(duì)應(yīng)的文件存在,就不運(yùn)行command
free_formyes需要執(zhí)行的腳本(沒(méi)有真正的參數(shù)為free_form)
executableno改變用來(lái)執(zhí)行命令的shell,是可執(zhí)行文件的絕對(duì)路徑
removesno如果這個(gè)參數(shù)對(duì)應(yīng)的文件不存在,就不運(yùn)行command,與creates參數(shù)作用相反
stdinno2.4后的新增,將命令的stdin設(shè)置為指定的值

4.2free_form參數(shù)

  • 必須參數(shù)指定需要遠(yuǎn)程執(zhí)行的命令。
  • free_form 參數(shù)與其他參數(shù)(如果想要使用一個(gè)參數(shù),那么則需要為這個(gè)參數(shù)賦值,也就是name=value模式)并不相同。
  • 如:需要在遠(yuǎn)程主機(jī)上執(zhí)行 ls 命令時(shí),錯(cuò)誤寫(xiě)法:free_form=ls ,因?yàn)椴?code>沒(méi)有任何參數(shù)的名字是 free_form,若要在遠(yuǎn)程主機(jī)中執(zhí)行 ls 命令時(shí),直接寫(xiě)成 ls 即可。因?yàn)?command 模塊的作用是執(zhí)行命令,所以任何一個(gè)可以在遠(yuǎn)程主機(jī)上執(zhí)行的命令都可以被稱(chēng)為free_form
  • 例:
[root@server ~]# ansible-inventory --graph  #分組查看
@all:|--@ungrouped:|  |--node1.example.com|  |--node2.example.com
[root@server ~]# ansible all -m command -a "ls /root"   #查看目錄
node2.example.com | CHANGED | rc=0 >>
公共
模板
視頻
圖片
文檔
下載
音樂(lè)
桌面
anaconda-ks.cfg
node1.example.com | CHANGED | rc=0 >>
公共
模板
視頻
圖片
文檔
下載
音樂(lè)
桌面
anaconda-ks.cfg
frp_0.56.0_linux_amd64
frp_0.56.0_linux_amd64.tar.gz
mysql-8.0.37-linux-glibc2.17-x86_64.tar.xz
[root@server ~]# ansible all -m command -a "cd /"
node2.example.com | CHANGED | rc=0 >>node1.example.com | CHANGED | rc=0 >>
[root@server ~]# ansible all -m command -a "pwd"
node2.example.com | CHANGED | rc=0 >>
/root
node1.example.com | CHANGED | rc=0 >>
/root
[root@server ~]# ansible all -m command -a "touch file.ansible"
node1.example.com | CHANGED | rc=0 >>node2.example.com | CHANGED | rc=0 >>[root@node1 ~]# ls
公共  文檔   模板  下載  anaconda-ks.cfg   file.ansible[root@node2 ~]# ls
公共  模板  視頻    anaconda-ks.cfg  file.ansible
[root@server ~]# ansible all -m command -a "ls /root creates=file.ansible"   #當(dāng)文件file.ansible存在則就不執(zhí)行前面的命令
node1.example.com | SUCCESS | rc=0 >>
skipped, since file.ansible existsDid not run command since 'file.ansible' exists
node2.example.com | SUCCESS | rc=0 >>
skipped, since file.ansible existsDid not run command since 'file.ansible' exists
[root@server ~]# ansible all -m command -a "ls /root removes=file.ansible"  #當(dāng)文件file.ansible不存在則就不執(zhí)行前面的命令
node2.example.com | CHANGED | rc=0 >>
公共
模板
視頻
圖片
文檔
下載
音樂(lè)
桌面
anaconda-ks.cfg
file.ansible
node1.example.com | CHANGED | rc=0 >>
公共
模板
視頻
圖片
文檔
下載
音樂(lè)
桌面
anaconda-ks.cfg
file.ansible
frp_0.56.0_linux_amd64
frp_0.56.0_linux_amd64.tar.gz
mysql-8.0.37-linux-glibc2.17-x86_64.tar.xz
#無(wú)法使用管道符和輸入輸出重定向
[root@server ~]# ansible all -m command -a "echo 'hello world' > file.ansible"
node1.example.com | CHANGED | rc=0 >>
hello world > file.ansible
node2.example.com | CHANGED | rc=0 >>
hello world > file.ansible
[root@server ~]# ansible all -m command -a "cat file.ansible"
node2.example.com | CHANGED | rc=0 >>node1.example.com | CHANGED | rc=0 >>[root@server ~]# ansible all -m command -a "ls /root | grep file.ansible"
node2.example.com | FAILED | rc=2 >>
file.ansible/root:
公共
模板
視頻
圖片
文檔
下載
音樂(lè)
桌面
anaconda-ks.cfg
file.ansiblels: 無(wú)法訪問(wèn) '|': 沒(méi)有那個(gè)文件或目錄
ls: 無(wú)法訪問(wèn) 'grep': 沒(méi)有那個(gè)文件或目錄non-zero return code
node1.example.com | FAILED | rc=2 >>
file.ansible/root:
公共
模板
視頻
圖片
文檔
下載
音樂(lè)
桌面
anaconda-ks.cfg
file.ansible
frp_0.56.0_linux_amd64
frp_0.56.0_linux_amd64.tar.gz
mysql-8.0.37-linux-glibc2.17-x86_64.tar.xzls: 無(wú)法訪問(wèn) '|': 沒(méi)有那個(gè)文件或目錄
ls: 無(wú)法訪問(wèn) 'grep': 沒(méi)有那個(gè)文件或目錄non-zero return code

5.shell模塊

5.1作用

    • 遠(yuǎn)程主機(jī)shell進(jìn)程執(zhí)行命令,從而支持shell的特性如管道等參數(shù)command模塊幾乎相同,但在執(zhí)行命令的時(shí)候調(diào)用的是/bin/sh

5.2例如

[root@server ~]# ansible all -m shell -a "tree chdir=/root"
node2.example.com | CHANGED | rc=0 >>
.
├── 公共
├── 模板
├── 視頻
├── 圖片
├── 文檔
├── 下載
├── 音樂(lè)
├── 桌面
├── anaconda-ks.cfg
└── file.ansible8 directories, 2 files
node1.example.com | CHANGED | rc=0 >>
.
├── 公共
├── 模板
├── 視頻
├── 圖片
├── 文檔
├── 下載
├── 音樂(lè)
├── 桌面
├── anaconda-ks.cfg
├── file.ansible
├── frp_0.56.0_linux_amd64
│   ├── frpc
│   ├── frpc.toml
│   └── LICENSE
├── frp_0.56.0_linux_amd64.tar.gz
└── mysql-8.0.37-linux-glibc2.17-x86_64.tar.xz9 directories, 7 files
[root@server ~]# ansible node1.example.com -m shell -a "echo 'hello world' > file.ansible"
node1.example.com | CHANGED | rc=0 >>[root@server ~]# ansible node1.example.com -m shell -a "cat /root/file.ansible"
node1.example.com | CHANGED | rc=0 >>
hello world

6.script模塊

  • scriptshell 類(lèi)似,都可以執(zhí)行腳本
  • 區(qū)別script執(zhí)行的腳本在ansible管理機(jī)上,而shell執(zhí)行的腳本必須先放到目標(biāo)節(jié)點(diǎn)上去,才能執(zhí)行
  • shell執(zhí)行可以使用環(huán)境變量bash等,但是script只是執(zhí)行.sh腳本,不能帶 bash

6.1示例

  • server端寫(xiě)一個(gè)t2.sh的腳本
[root@server ~]# vim t2.sh
#!/bin/bash
echo "hello world"[root@server ~]# ansible all -m script -a "t2.sh"
node2.example.com | CHANGED => {"changed": true,"rc": 0,"stderr": "Shared connection to node2.example.com closed.\r\n","stderr_lines": ["Shared connection to node2.example.com closed."],"stdout": "hello world\r\n","stdout_lines": ["hello world"]
}
node1.example.com | CHANGED => {"changed": true,"rc": 0,"stderr": "Shared connection to node1.example.com closed.\r\n","stderr_lines": ["Shared connection to node1.example.com closed."],"stdout": "hello world\r\n","stdout_lines": ["hello world"]
}
  • 在目標(biāo)節(jié)點(diǎn)上
[root@node1 ~]# vim t2.sh
#!/bin/bash
echo "hello world"[root@node2 ~]# vim t2.sh
#!/bin/bash
echo "hello world"[root@server ~]# ansible all -m shell -a "bash t2.sh"
node2.example.com | CHANGED | rc=0 >>
hello world
node1.example.com | CHANGED | rc=0 >>
hello world

7.raw模塊

raw模塊主要用于執(zhí)行一些低級(jí)的命令,一般適用于下列兩種場(chǎng)景

  • 第一種:在較老的(python2.4和之前的版本)主機(jī)上執(zhí)行命令
  • 第二種:對(duì)任何沒(méi)有安裝python的設(shè)備(如路由器
  • 注意:在任何其他情況下,使用shellcommand模塊更為合適

7.1參數(shù)

名稱(chēng)必選備注
executableno(可以不選)改變用來(lái)執(zhí)行命令的shell,是可執(zhí)行文件的絕對(duì)路徑
free_formyes需要執(zhí)行的腳本(沒(méi)有真正的參數(shù)為free_form)

7.2示例

[root@server ~]# ansible all -m raw -a "pwd"
node1.example.com | CHANGED | rc=0 >>
/root
Shared connection to node1.example.com closed.node2.example.com | CHANGED | rc=0 >>
/root
Shared connection to node2.example.com closed.
[root@server ~]# ansible all -m raw -a "echo 'hello world'"
node1.example.com | CHANGED | rc=0 >>
hello world
Shared connection to node1.example.com closed.node2.example.com | CHANGED | rc=0 >>
hello world
Shared connection to node2.example.com closed.

文件操作模塊

1.file模塊

作用:實(shí)現(xiàn)對(duì)文件的基本操作,如:創(chuàng)建目錄或文件,刪除目錄或文件,修改文件權(quán)限

1.1參數(shù)

  • path必須參數(shù),用于指定要操作的文件目錄,在之前版本的ansible中,使用dest參數(shù)或者name參數(shù)指定要操作的文件或目錄,為了兼容之前的版本,使用destname也可以
  • state:
    • 格式path=“路徑” state= touch | directory | link | hard | absent
    • 此參數(shù)使用靈活,如:在遠(yuǎn)程主機(jī)中創(chuàng)建一個(gè)目錄,則使用path參數(shù)指定對(duì)應(yīng)的目錄路徑,假設(shè)在遠(yuǎn)程主機(jī)上創(chuàng)建/testdir/a/b目錄,則設(shè)置路徑:path=/testdir/a/b,但ansible無(wú)法從/testdir/a/b這個(gè)路徑看出b是一個(gè)文件還是一個(gè)目錄,所以需要通過(guò)state參數(shù)進(jìn)行說(shuō)明
參數(shù)含義
state=absent刪除遠(yuǎn)程機(jī)器上的指定文件目錄
state=directory創(chuàng)建一個(gè)空目錄
state=file查看指定目錄是否存在
state=touch創(chuàng)建一個(gè)空文件
state=hard/link創(chuàng)建鏈接文件
  • src:當(dāng)state設(shè)置為link或者hard時(shí),表示創(chuàng)建一個(gè)軟鏈硬鏈,則必須通過(guò)指明src參數(shù)即可指定鏈接源

  • force : 當(dāng)state=link的時(shí),使用force=yes 參數(shù)表示強(qiáng)制創(chuàng)建鏈接文件,該文件分為三種情況:

    • 當(dāng)要?jiǎng)?chuàng)建的鏈接文件指向的源文件不存在時(shí),使用此參數(shù),可以先強(qiáng)制創(chuàng)建出鏈接文件
    • 當(dāng)存儲(chǔ)目錄中已經(jīng)存在鏈接文件同名的文件時(shí),會(huì)將同名文件覆蓋為鏈接文件相當(dāng)于刪除同名文件創(chuàng)建鏈接文件
    • 當(dāng)你要?jiǎng)?chuàng)建鏈接文件目錄中已經(jīng)存在鏈接文件同名的文件,并且鏈接文件指向的源文件也不存在,這時(shí)會(huì)強(qiáng)制替換同名文件為鏈接文件
  • owner:用于指定被操作文件的屬主信息屬主對(duì)應(yīng)的用戶(hù)必須在遠(yuǎn)程主機(jī)中存在,否則會(huì)報(bào)錯(cuò)

  • group:用于指定被操作文件的屬組屬組對(duì)應(yīng)的必須在遠(yuǎn)程主機(jī)中存在,否則會(huì)報(bào)錯(cuò)

  • mode:用于指定被操作文件權(quán)限,如:

    • 要將文件權(quán)限設(shè)置為: “rw-r-x---”,則可以使用mode=650進(jìn)行設(shè)置,或者使用mode=0650
    • 要設(shè)置特殊權(quán)限,如:為二進(jìn)制文件設(shè)置suid,則可以使用mode=4700
  • recurse:當(dāng)要操作的文件目錄時(shí),recurse設(shè)置為yes可以遞歸修改目錄中文件的屬性權(quán)限

1.2示例

  • 在所有遠(yuǎn)程主機(jī)上創(chuàng)建一個(gè)名為 data的目錄,如果存在不做操作
[root@server ~]# ansible all -m file -a "path=/root/data state=directory"
node1.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"gid": 0,"group": "root","mode": "0755","owner": "root","path": "/root/data","size": 6,"state": "directory","uid": 0
}
node2.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"gid": 0,"group": "root","mode": "0755","owner": "root","path": "/root/data","size": 6,"state": "directory","uid": 0
}[root@server ~]# ansible all -m command -a "ls chdir=/root"
node1.example.com | CHANGED | rc=0 >>
公共
模板
視頻
圖片
文檔
下載
音樂(lè)
桌面
anaconda-ks.cfg
data
file.ansible
frp_0.56.0_linux_amd64
frp_0.56.0_linux_amd64.tar.gz
mysql-8.0.37-linux-glibc2.17-x86_64.tar.xz
t2.sh
node2.example.com | CHANGED | rc=0 >>
公共
模板
視頻
圖片
文檔
下載
音樂(lè)
桌面
anaconda-ks.cfg
data
file.ansible
t2.sh
  • node1主機(jī)上創(chuàng)建一個(gè)名為testfile1的文件,如果testfile1文件已經(jīng)存在,則會(huì)更新文件的時(shí)間戳,與touch命令的作用相同
[root@server ~]# ansible node1.example.com -m file -a "path=/root/data/testfile1 state=touch"
node1.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"dest": "/root/data/testfile1","gid": 0,"group": "root","mode": "0644","owner": "root","size": 0,"state": "file","uid": 0
}[root@server ~]# ansible node1.example.com -m command -a "ls chdir=/root/data"
node1.example.com | CHANGED | rc=0 >>
file1
testfile1
  • node1上為testfile1文件創(chuàng)建軟鏈接文件,軟鏈接名為linkfile1
[root@server ~]# ansible node1.example.com -m file -a "path=/root/data/linkfile1 state=link src=/root/data/testfile1"
node1.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"dest": "/root/data/linkfile1","gid": 0,"group": "root","mode": "0777","owner": "root","size": 20,"src": "/root/data/testfile1","state": "link","uid": 0
}[root@server ~]# ansible node1.example.com -m command -a "ls chdir=/root/data"
node1.example.com | CHANGED | rc=0 >>
file1
linkfile1
testfile1
  • node1上為 testfile1 文件創(chuàng)建硬鏈接文件,硬鏈接名為 hardfile1(類(lèi)似于復(fù)制
[root@server ~]# ansible node1.example.com -m file -a "path=/root/data/hardfile1 state=hard src=/root/data/testfile1"
node1.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"dest": "/root/data/hardfile1","gid": 0,"group": "root","mode": "0644","owner": "root","size": 0,"src": "/root/data/testfile1","state": "hard","uid": 0
}[root@server ~]# ansible node1.example.com -m command -a "ls /root/data"
node1.example.com | CHANGED | rc=0 >>
file1
hardfile1
linkfile1
testfile1
  • 在創(chuàng)建鏈接文件時(shí),如果源文件不存在,或者鏈接文件與其他文件同名時(shí),強(qiáng)制覆蓋同名文件或者創(chuàng)建鏈接文件,參考上述force參數(shù)的解釋
[root@server ~]# ansible node1.example.com -m file -a "path=/root/data/linkfile3 state=link src=/root/data/123 force=yes"   #注意:123文件不存在
[WARNING]: Cannot set fs attributes on a non-existent symlink target. follow should be
set to False to avoid this.
node1.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"dest": "/root/data/linkfile3","src": "/root/data/123"
}[root@server ~]# ansible node1.example.com -m command -a "ls chdir=/root/data"
node1.example.com | CHANGED | rc=0 >>
file1
hardfile1
linkfile1
linkfile3
testfile1
  • 刪除node1上的/root/data目錄
[root@server ~]# ansible node1.example.com -m file -a "path=/root/data state=absent"
node1.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"path": "/root/data","state": "absent"
}[root@server ~]# ansible node1.example.com -m command -a "ls chdir=/root"
node1.example.com | CHANGED | rc=0 >>
公共
模板
視頻
圖片
文檔
下載
音樂(lè)
桌面
anaconda-ks.cfg
file.ansible
frp_0.56.0_linux_amd64
frp_0.56.0_linux_amd64.tar.gz
mysql-8.0.37-linux-glibc2.17-x86_64.tar.xz
t2.sh
  • 創(chuàng)建文件目錄的時(shí)候指定屬主,或者修改遠(yuǎn)程主機(jī)上的文件或目錄的屬主
[root@server ~]# ansible all -m file -a "path=/root/testfile1 state=touch owner=redhat"  #新建文件并指定為屬主為redhat,組默認(rèn)為root
node2.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"dest": "/root/testfile1","gid": 0,"group": "root","mode": "0644","owner": "redhat","size": 0,"state": "file","uid": 1000
}
node1.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"dest": "/root/testfile1","gid": 0,"group": "root","mode": "0644","owner": "redhat","size": 0,"state": "file","uid": 1000
}[root@server ~]# ansible all -m file -a "path=/root/testfile2 state=touch"   #新建文件,默認(rèn)為root
node2.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"dest": "/root/testfile2","gid": 0,"group": "root","mode": "0644","owner": "root","size": 0,"state": "file","uid": 0
}
node1.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"dest": "/root/testfile2","gid": 0,"group": "root","mode": "0644","owner": "root","size": 0,"state": "file","uid": 0
}
#修改屬主和組
[root@server ~]# ansible all -m file -a "path=/root/testfile2 state=touch owner=redhat group=redhat"
node1.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"dest": "/root/testfile2","gid": 1000,"group": "redhat","mode": "0644","owner": "redhat","size": 0,"state": "file","uid": 1000
}
node2.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"dest": "/root/testfile2","gid": 1000,"group": "redhat","mode": "0644","owner": "redhat","size": 0,"state": "file","uid": 1000
}
  • 創(chuàng)建文件或目錄的時(shí)候指定權(quán)限,或者修改遠(yuǎn)程主機(jī)上的文件或目錄的權(quán)限
[root@server ~]# ansible all -m file -a "path=/root/testfile1 state=touch mode=777"
node1.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"dest": "/root/testfile1","gid": 0,"group": "root","mode": "0777","owner": "redhat","size": 0,"state": "file","uid": 1000
}
node2.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"dest": "/root/testfile1","gid": 0,"group": "root","mode": "0777","owner": "redhat","size": 0,"state": "file","uid": 1000
}
  • 遞歸方式將目錄中的文件屬主屬組都設(shè)置為redhat
[root@server ~]# ansible all -m file -a "path=/data/test/demo state=directory owner=redhat group=redhat recurse=yes"
node2.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"gid": 1000,"group": "redhat","mode": "0755","owner": "redhat","path": "/data/test/demo","size": 6,"state": "directory","uid": 1000
}
node1.example.com | CHANGED => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"},"changed": true,"gid": 1000,"group": "redhat","mode": "0755","owner": "redhat","path": "/data/test/demo","size": 6,"state": "directory","uid": 1000
}[root@node1 ~]# ll /data/test
總用量 0
drwxr-xr-x 2 redhat redhat 6  77 22:15 demo[root@node2 ~]# ll /data/test/
總用量 0
drwxr-xr-x 2 redhat redhat 6  77 22:15 demo

2.copy模塊

作用:拷貝文件,將ansible主機(jī)上的文件拷貝到遠(yuǎn)程受控主機(jī)中

2.1參數(shù)

參數(shù)默認(rèn)值含義
src用于指定需要copy的文件或目錄
backupno,yes當(dāng)遠(yuǎn)程主機(jī)的目標(biāo)路徑中已存在同名文件,并且與ansible主機(jī)中的文件內(nèi)容不同時(shí),是否對(duì)遠(yuǎn)程主機(jī)的文件進(jìn)行備份,設(shè)為yes時(shí),會(huì)先備份遠(yuǎn)程主機(jī)中的文件,然后再拷貝到遠(yuǎn)程主機(jī)
content當(dāng)不使用src指定拷貝的文件時(shí),可以使用content直接指定文件內(nèi)容,src與content兩個(gè)參數(shù)必有其一,否則會(huì)報(bào)錯(cuò)
dest用于指定文件將被拷貝到遠(yuǎn)程主機(jī)的哪個(gè)目錄中,dest為必須參數(shù)
group指定文件拷貝到遠(yuǎn)程主機(jī)后的屬組,但是遠(yuǎn)程主機(jī)上必須有對(duì)應(yīng)的組,否則會(huì)報(bào)錯(cuò)
owner指定文件拷貝到遠(yuǎn)程主機(jī)后的屬主,但是遠(yuǎn)程主機(jī)上必須有對(duì)應(yīng)的用戶(hù),否則會(huì)報(bào)
mode錯(cuò)文指定文件拷貝到遠(yuǎn)程主機(jī)后的權(quán)限,如果你想將權(quán)限設(shè)置為"rw-r–r–",則可以使用mode=0644表示,如果你想要在user對(duì)應(yīng)的權(quán)限位上添加執(zhí)行權(quán)限,則可以使用mode=u+x表示
forceno,yes當(dāng)遠(yuǎn)程主機(jī)的目標(biāo)路徑中已經(jīng)存在同名文件,并且與ansible主機(jī)中的文件內(nèi)容不同時(shí),是否強(qiáng)制覆蓋,默認(rèn)值為yes,表示覆蓋,如果設(shè)置為no,則不會(huì)執(zhí)行覆蓋拷貝操作,遠(yuǎn)程主機(jī)中的文件保持不變
http://www.risenshineclean.com/news/23074.html

相關(guān)文章:

  • ios網(wǎng)站開(kāi)發(fā)工具有哪些怎么做網(wǎng)址
  • 做網(wǎng)站有哪些注意事項(xiàng)百度關(guān)鍵詞在線優(yōu)化
  • dw做網(wǎng)站怎么用到j(luò)ava友情鏈接網(wǎng)站
  • 鄭州餐飲 網(wǎng)站建設(shè)小視頻關(guān)鍵詞匯總
  • 東莞桂城網(wǎng)站建設(shè)外貿(mào)網(wǎng)站推廣服務(wù)
  • 網(wǎng)站建設(shè)成都時(shí)事新聞熱點(diǎn)
  • 開(kāi)發(fā)網(wǎng)站公司收入瀏覽器廣告投放
  • 微商城小程序哪個(gè)好青島建站seo公司
  • 暗網(wǎng)做網(wǎng)站2023能用的磁力搜索引擎
  • b2b網(wǎng)站制作上海aso蘋(píng)果關(guān)鍵詞優(yōu)化
  • 龍南網(wǎng)站建設(shè)怎么做網(wǎng)絡(luò)營(yíng)銷(xiāo)
  • 三明seo怎么優(yōu)化關(guān)鍵詞
  • 什么系統(tǒng)做網(wǎng)站好蘇州網(wǎng)站建設(shè)公司排名
  • 做網(wǎng)站為什么圖片上傳不了怎樣制作免費(fèi)網(wǎng)頁(yè)
  • 高性能網(wǎng)站建設(shè)進(jìn)階指南 pdf百度熱搜廣告設(shè)計(jì)公司
  • 做h5網(wǎng)站pc加手機(jī)版要多少錢(qián)百度搜題網(wǎng)頁(yè)版入口
  • b2c網(wǎng)站源碼新手如何做網(wǎng)上銷(xiāo)售
  • 南寧網(wǎng)站建設(shè)設(shè)計(jì)制作站長(zhǎng)之家ip查詢(xún)
  • 做淘客網(wǎng)站需要企業(yè)的域名深圳網(wǎng)絡(luò)推廣公司排名
  • 網(wǎng)站建設(shè)公司2018網(wǎng)站優(yōu)化排名優(yōu)化
  • 網(wǎng)站做統(tǒng)計(jì)愛(ài)站網(wǎng)挖掘工具
  • 貴陽(yáng)網(wǎng)站空間seo人員的職責(zé)
  • 大芬地鐵站附近做網(wǎng)站百度收錄規(guī)則
  • b2b網(wǎng)站用戶(hù)體驗(yàn)重慶網(wǎng)站seo多少錢(qián)
  • 如何阿里巴巴網(wǎng)站做推廣方案seo外鏈工具源碼
  • 安卓手機(jī)做網(wǎng)站seo建站平臺(tái)哪家好
  • 河北漢佳 做網(wǎng)站的公司百度地圖網(wǎng)頁(yè)版
  • 網(wǎng)站建設(shè)基本流程重慶關(guān)鍵詞優(yōu)化
  • 做設(shè)計(jì)需要素材的常用網(wǎng)站有哪些營(yíng)銷(xiāo)助手下載app下載
  • 設(shè)計(jì)網(wǎng)站公司地址深圳全網(wǎng)營(yíng)銷(xiāo)系統(tǒng)