mirror of https://github.com/jumpserver/jumpserver
perf(systemuser): 优化系统用户家目录权限更改
parent
0c1f717fb2
commit
531de188d6
|
@ -66,24 +66,27 @@ 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),
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'Check home dir exists',
|
|
||||||
'action': {
|
|
||||||
'module': 'stat',
|
|
||||||
'args': 'path=/home/{}'.format(username)
|
|
||||||
},
|
|
||||||
'register': 'home_existed'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': "Set home dir permission",
|
|
||||||
'action': {
|
|
||||||
'module': 'file',
|
|
||||||
'args': "path=/home/{0} owner={0} group={0} mode=700".format(username)
|
|
||||||
},
|
|
||||||
'when': 'home_existed.stat.exists == true'
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
if not system_user.home:
|
||||||
|
tasks.extend([
|
||||||
|
{
|
||||||
|
'name': 'Check home dir exists',
|
||||||
|
'action': {
|
||||||
|
'module': 'stat',
|
||||||
|
'args': 'path=/home/{}'.format(username)
|
||||||
|
},
|
||||||
|
'register': 'home_existed'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': "Set home dir permission",
|
||||||
|
'action': {
|
||||||
|
'module': 'file',
|
||||||
|
'args': "path=/home/{0} owner={0} group={0} mode=700".format(username)
|
||||||
|
},
|
||||||
|
'when': 'home_existed.stat.exists == true'
|
||||||
|
}
|
||||||
|
])
|
||||||
if password:
|
if password:
|
||||||
tasks.append({
|
tasks.append({
|
||||||
'name': 'Set {} password'.format(username),
|
'name': 'Set {} password'.format(username),
|
||||||
|
|
Loading…
Reference in New Issue