ansible常用模組整理
阿新 • • 發佈:2018-12-05
0 command
預設,直接-a "ifconfig"1 shell
用到變數、管道時 ansible s21 -m shell -a "echo pwd | passwd --stdin user1" 此時用command無效2 script
將本地指令碼複製到遠端,並執行 ansible s21 -m script -a "/tmp/test.sh"3 debug
ansible s21 -m debug -a "msg={{ 'mypassword' | password_hash('sha512', 'mysecretsalt') }}"4 cron
5 user
5.1 playbook直接設定方式6 group
ansible s21 -m group -a 'name=mysql system=yes' ansible s21 -m user -a 'name=mysql system=yes group=mysql'7 copy
有源拷貝ansible s21 -m copy -a "src=user.yml dest=/tmp/ owner=u1 mode=600" 無源建立 ansible s225 -m copy -a "content='aaa\r\n' dest=/tmp/test/abc"