Creating a new user and password with Ansible

后端 未结 22 1510
迷失自我
迷失自我 2020-12-22 17:00

I have an ansible task which creates a new user on ubuntu 12.04;

- name: Add deployment user
    action: user name=deployer password=mypassword
22条回答
  •  鱼传尺愫
    2020-12-22 17:19

    This is the easy way:

    ---
    - name: Create user
      user: name=user shell=/bin/bash home=/srv/user groups=admin,sudo generate_ssh_key=yes ssh_key_bits=2048
    - name: Set password to user
      shell: echo user:plain_text_password | sudo chpasswd
      no_log: True
    

提交回复
热议问题