perf(systemuser): 优化系统用户家目录权限更改

pull/4928/head
ibuler 2020-11-03 13:38:51 +08:00 committed by Jiangjie.Bai
parent 0c1f717fb2
commit 531de188d6
1 changed files with 19 additions and 16 deletions

View File

@ -66,7 +66,10 @@ def get_push_unixlike_system_user_tasks(system_user, username=None):
'module': 'group', 'module': 'group',
'args': 'name={} state=present'.format(username), 'args': 'name={} state=present'.format(username),
} }
}, }
]
if not system_user.home:
tasks.extend([
{ {
'name': 'Check home dir exists', 'name': 'Check home dir exists',
'action': { 'action': {
@ -83,7 +86,7 @@ def get_push_unixlike_system_user_tasks(system_user, username=None):
}, },
'when': 'home_existed.stat.exists == true' 'when': 'home_existed.stat.exists == true'
} }
] ])
if password: if password:
tasks.append({ tasks.append({
'name': 'Set {} password'.format(username), 'name': 'Set {} password'.format(username),