YAML_05 定义一个变量创建用户,设置密码
阅读原文时间:2023年07月08日阅读:2

ansible]# vim user2.yml

---

- hosts: cache

  remote_user: root

  vars:

    user: wangwu

  tasks:

    - user:

        name: "{{user}}"

        group: root

        password: "{{'123456' | password_hash('sha512')}}"

    - shell: chage -d 0 "{{user}}"

ansible]# ansible-playbook user2.yml