|
|
|
@ -202,11 +202,16 @@ def map_obj_to_ele(module, want):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
operation = 'merge'
|
|
|
|
operation = 'merge'
|
|
|
|
|
|
|
|
|
|
|
|
user = SubElement(login, 'user', {'operation': operation})
|
|
|
|
if item['name'] != 'root':
|
|
|
|
|
|
|
|
user = SubElement(login, 'user', {'operation': operation})
|
|
|
|
SubElement(user, 'name').text = item['name']
|
|
|
|
SubElement(user, 'name').text = item['name']
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
user = auth = SubElement(element, 'root-authentication', {'operation': operation})
|
|
|
|
|
|
|
|
|
|
|
|
if operation == 'merge':
|
|
|
|
if operation == 'merge':
|
|
|
|
|
|
|
|
if item['name'] == 'root' and (not item['active'] or item['role'] or item['full_name']):
|
|
|
|
|
|
|
|
module.fail_json(msg="'root' account cannot be deactivated or be assigned a role and a full name")
|
|
|
|
|
|
|
|
|
|
|
|
if item['active']:
|
|
|
|
if item['active']:
|
|
|
|
user.set('active', 'active')
|
|
|
|
user.set('active', 'active')
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
@ -219,7 +224,8 @@ def map_obj_to_ele(module, want):
|
|
|
|
SubElement(user, 'full-name').text = item['full_name']
|
|
|
|
SubElement(user, 'full-name').text = item['full_name']
|
|
|
|
|
|
|
|
|
|
|
|
if item.get('sshkey'):
|
|
|
|
if item.get('sshkey'):
|
|
|
|
auth = SubElement(user, 'authentication')
|
|
|
|
if 'auth' not in locals():
|
|
|
|
|
|
|
|
auth = SubElement(user, 'authentication')
|
|
|
|
if 'ssh-rsa' in item['sshkey']:
|
|
|
|
if 'ssh-rsa' in item['sshkey']:
|
|
|
|
ssh_rsa = SubElement(auth, 'ssh-rsa')
|
|
|
|
ssh_rsa = SubElement(auth, 'ssh-rsa')
|
|
|
|
elif 'ssh-dss' in item['sshkey']:
|
|
|
|
elif 'ssh-dss' in item['sshkey']:
|
|
|
|
|