Déployer un mot de passe pour un admin local depuis Ansible
Création du vault :
> $ ansible-vault encrypt_string 'Password' --name 'localpass_pc'
Playbook
> $ cat set-pc-localAdmin.yml
> - hosts: windows
> vars:
> localpass_pc: !vault |
> $ANSIBLE_VAULT;1.1;AES256
> 61303138326636383434313468744563798711626463616133656461326364346536303138313562
> 6335613432613630623677353236616239313766666236610a303061643565386334613465326638
> 64303835653036613861663757803561643661393666643230363433666637313765666635646165
> 33313865623713214613156797252888464465444553376662666463383333653165356533343236
> 6463
> tasks:
> - name : Create Local Admin SAS
> win_shell: |
> $Password = ConvertTo-SecureString {{ localpass_sasds }} -AsPlainText -Force
> Enable-LocalUser -Name "Administrateur"
> Set-LocalUser Administrateur -Password $Password