kxr / ocpcr

Ansible playbook to generate an HTML cluster overview report for OpenShift 3
GNU General Public License v3.0
27 stars 20 forks source link

System Resources/System Services Informations #5

Open fabianoflorentino opened 3 years ago

fabianoflorentino commented 3 years ago

I have some trouble when tasks get node info, you can help me?

image

kxr commented 3 years ago

@fabianoflorentino Sure. Once the playbook finishes, you will find a hidden directory in the playbook directory called .localtmphc with a bunch of files. One of those files should be hostvars.json. Is it possible to share that file here?

fabianoflorentino commented 3 years ago

Hi Khizer,

Attach file.

Thanks for your attention :)

hostvars.json.zip

fabianoflorentino commented 3 years ago

Hi Khizer,

Attach file.

Thanks for your attention :)

hostvars.json.zip

Hi Khizer,

did you receive the file?

kxr commented 3 years ago

@fabianoflorentino Yes I did receive the file, but unfortunately I got very busy this week. I will check it asap.

kxr commented 3 years ago

@fabianoflorentino Sorry for the long delay. I checked the file that you attached. The problem seems to be that Ansible for some reason is missing the core/default hostvars that we are relying on.

So before I explain more I will like to give you a short summary of how this playbook works. The first three blocks in ocpcr/cluster-report.yaml collect information from nodes/cluster.

Then, in the fourth block "# Process Cluster Info Locally", the ansible hostvars are dumped. This is what I requested and you shared. Next values from the dumped hostvars.json file are used to populate the jinja2 templates that make up final the html report.

For example, see here we pickup the ansible_architecture value from hostvars.json and populate it in the template. This seems to be working fine, the variable is present in the hostvars.json dump and it is populated in the screenshot that you shared (Arch column).

To my surprise, some hostvars are missing for example ansible_processor_vcpus, which is used to populate the vCPU column. I am not sure why these variables are missing.

May be you are using a newer version of ansible and things have changed. Can you tell me what version of ansible you used to run this playbook. And if possible can you try this playbook with ansible version 2.6?

kxr commented 3 years ago

Also, try the following from the bastion host (pick any one node):

ansible -i /path/to/inventory <node-name> -m setup | grep "ansible_processor_vcpus\|ansible_mem"

Do you see these default ansible variables? For example I see:

# ansible -i /etc/ansible/hosts ocp311-m1.local -m setup | grep "ansible_processor_vcpus\|ansible_mem"
        "ansible_memfree_mb": 1036, 
        "ansible_memory_mb": {
        "ansible_memtotal_mb": 2870, 
        "ansible_processor_vcpus": 4,