From 104a275369b32d8cd8a3cde6e8606f09223a353b Mon Sep 17 00:00:00 2001 From: xpk Date: Fri, 3 May 2019 20:06:23 +0800 Subject: [PATCH] enh: replaced with loop --- tasks/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index e17042c..2602944 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -9,7 +9,7 @@ shell: /bin/bash groups: "{{ group }},ssh_access" password: "{{lookup('password', 'cred.' + item + '.pass chars=ascii_letters,digits,hexdigitsi length=15') | password_hash('sha512')}}" - with_items: "{{userlist}}" + loop: "{{userlist}}" - name: Add user to sudoers lineinfile: @@ -18,16 +18,16 @@ line: "{{ item }} ALL=(ALL) NOPASSWD: ALL" mode: 0440 when: sudoers - with_items: "{{userlist}}" + loop: "{{userlist}}" - name: Display generated password debug: msg: "Generated password for {{item}}: {{lookup('password', 'cred.' + item + '.pass chars=ascii_letters,digits,hexdigitsi length=15')}}" - with_items: "{{userlist}}" + loop: "{{userlist}}" - name: Remove password files created by ansible file: path: cred.{{item}}.pass state: absent - with_items: "{{userlist}}" + loop: "{{userlist}}"