-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.yml
37 lines (33 loc) · 943 Bytes
/
user.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
- hosts: idrac
connection: local
gather_facts: False
vars:
ansible_python_interpreter: python
tasks:
- name: Get iDRAC user facts
redfish_facts:
baseuri: "{{ inventory_hostname }}"
username: "{{ idrac_user }}"
password: "{{ idrac_password }}"
category: "Accounts"
command: "ListUsers"
register: result
tags:
- root-user-password
- name: Extract the root user account ID
set_fact:
root_user: "{{ redfish_facts.user.entries | selectattr('UserName', 'equalto', 'root') | list }}"
tags:
- root-user-password
- name: Change the root user password
redfish_command:
baseuri: "{{ inventory_hostname }}"
username: "{{ idrac_user }}"
password: "{{ idrac_password }}"
category: "Accounts"
command: "UpdateUserPassword"
id: "{{ root_user[0].Id }}"
new_password: "new_pa$$w0rd"
tags:
- root-user-password