I have this Dell iDRAC management module I'm trying to use.

For some bizarre reason it seems to demand an IP address instead of a respecting the hosts: directive. Here's the example I have been given:

- hosts: idracs
  connection: local
  name: Check LC Ready Status
  gather_facts: False

  - name: Check LC Ready Status
       idrac_ip:   "{{ idrac_ip }}"
       idrac_user: "{{ idrac_user }}"
       idrac_pwd:  "{{ idrac_pwd }}"

I can't see how to make idrac_ip into a variable. Is /etc/ansible/hosts what I should be using or should I create another(different) inventory object?

  • I don't know if Ansible can gather facts about iDRAC devices. I don't know what OS they run. – mr.zog Feb 14 '19 at 19:27
  • You want it to come from the inventory, but how is the ip defined in the inventory? Is it just ansible_hostname, or have you stored it in another variable. It would help if you gave us an example of what you have in your inventory. – Zoredache Feb 14 '19 at 20:05
  • Which inventory are you talking about? I do not have IP addresses in /etc/ansible/hosts. I have fqdns in the hosts file. – mr.zog Feb 14 '19 at 20:19
  • Do the fqdns correctly resolve to an IP address? If yes, I would bet you should be able to use idrac_ip:: "{{ ansible_hostname }}". If you have the same user/password for all your systems you could use a group_vars, or define those in the play, or task. – Zoredache Feb 14 '19 at 21:40
  • The fqdns do resolve properly. I wouldn't consider using them if they didn't. Yes the same credentials work on all of them. – mr.zog Feb 14 '19 at 23:05

As far as I can tell you need to define these facts for each host yourself.

It appears you're using the Dell EMC OpenManage Ansible modules. The way these examples are designed, they appear to expect the variables to come from host facts. So you can just define host_vars for each host. For example, you might create host_vars/myserver.example.com/idrac.yml:

idrac_user: root
idrac_pw: calvin

Of course, you could get the variables elsewhere for some of the other operations you might perform, e.g. from static facts set on each host or from a dynamic inventory script, but this should get you started.

  • Thanks a lot Michael. There is a host_vars dir in the repo. I'll try using that. – mr.zog Feb 14 '19 at 22:01
  • I never got this to work. – mr.zog Feb 15 '19 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.