ansible all -m copy -a 'src=/etc/resolv.conf dest=/etc/resolv.conf' //复制文件
ansible all -m copy -a 'src=/etc/yum.repos.d/ dest=/etc/yum.repos.d/' //复制目录
lineinfile模块
类似sed的一种行编辑替换模块
path 目标文件
regexp 正则表达式,要修改的行
line 最终修改的结果
ansible db -m lineinfile -a '
> path="/etc/my.cnf"
> regexp="^binlog-format"
> line="binlog-format=row" '
replace模块
类似sed的一种行编辑替换模块
path 目的文件
regexp 正则表达式
replace 替换后的结果
ansible db -m lineinfile -a '
> path="/etc/my.cnf"
> regexp="=row"
> line="=mixed" '
ansible-doc & ping(ansible-doc文档,很重要)command模块shell模块script模块copy模块lineinfile|replace模块yum模块service模块setup模块ansible-doc和ping模块ansible-doc模块的手册相当于shell的man,很重要ansible-doc -l 列出所有模块a...