-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredfish_user.yml
33 lines (29 loc) · 908 Bytes
/
redfish_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
---
- hosts: idrac
connection: local
gather_facts: no
vars:
ansible_python_interpreter: python
tasks:
- name: List users
redfish_facts:
baseuri: "{{ inventory_hostname }}"
username: "{{ idrac_user }}"
password: "{{ idrac_password }}"
category: Accounts
command: ListUsers
register: users_list
- name: Get root user ID
set_fact:
root_user_id: "{{ users_list.ansible_facts.redfish_facts.user.entries | selectattr('UserName', 'equalto', 'root') | map(attribute='Id') | list | first }}"
- name: Change password for the root user
redfish_command:
baseuri: "{{ inventory_hostname }}"
username: "{{ idrac_user }}"
password: "{{ idrac_password }}"
category: Accounts
command: UpdateUserPassword
id: "{{ root_user_id | int }}"
new_password: "{{ new_root_user_password }}"
tags:
- update-pwd