Ansible. Генерация и смена пароля пользователя

---
- hosts: all

  vars_prompt:
    - name: "USER"
      prompt: "Enter USER name"
      private: no

    - name: "PASS"
      prompt: "Enter PASS"
      private: yes
      confirm: yes

  tasks:
    - name: set password
      shell: echo -e "{{PASS}}\n{{PASS}}" | (passwd --stdin "{{USER}}")

---
- hosts: all

  vars_prompt:
    - name: "USER"
      prompt: "Enter USER name"
      private: no

  tasks:
    - name: generate new password
      shell: /usr/bin/pwgen 10 -c1
      register: PASS

    - name: save password in file /root/user_password.txt
      shell: echo "{{USER}}" > /root/user_password.txt; echo "{{PASS.stdout}}" >> /root/user_password.txt

    - name: set password
      shell: echo -e "{{PASS.stdout}}\n{{PASS.stdout}}" | (passwd --stdin "{{USER}}")
  • ansible._generacija_i_smena_parolja_polzovatelja.txt
  • Последние изменения: 2017/04/27 00:00
  • (внешнее изменение)