本文共 501 字,大约阅读时间需要 1 分钟。
在执行 ansible playbook是报错
创建用户并密码
tasks:
- name: create user become: yes become_method: su become_user: root user: home={ { home }} name={ { username }} createhome=yes system=yes state=present shell=/bin/bash - name: set passwd become: yes become_method: su become_user: root shell: /usr/bin/echo { { pwd }}|/usr/bin/passwd --stdin { { username }}
报错:
passwd:只能指定一个用户的名称。
最后发现:
shell: /usr/bin/echo {
{ pwd }}|/usr/bin/passwd --stdin { { username }}这条命令是网上复制过来的,个人认为是字符集问题
解决方法:
找台机器手动敲一遍然后在粘贴到yml里就可以了
转载地址:http://bugpb.baihongyu.com/