From eb61e393726b279a70d31b2ff6fbbd1d56c2fe16 Mon Sep 17 00:00:00 2001 From: Larry Huang Date: Mon, 2 Sep 2019 03:04:50 +0800 Subject: [PATCH] use password module to generate password --- roles/common/tasks/facts.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/roles/common/tasks/facts.yml b/roles/common/tasks/facts.yml index c064d7b..c0581d4 100644 --- a/roles/common/tasks/facts.yml +++ b/roles/common/tasks/facts.yml @@ -5,10 +5,8 @@ register: CA_password - name: Generate p12 export password - shell: > - openssl rand 8 | - python -c 'import sys,string; chars=string.ascii_letters + string.digits + "_@"; print("".join([chars[ord(c) % 64] for c in list(sys.stdin.read())]))' - register: p12_password_generated + set_fact: + p12_password_generated: "{{ lookup('password', '/dev/null length=9 chars=ascii_letters,digits,!,@,#,$,%,^,&,*,<,>,/,?') }}" when: p12_password is not defined tags: update-users become: false