Corrected condition to auto add additional hosts #242
Conversation
Hello contributor, thanks for submitting a PR for this project! I am the bot who triggers "standard-CI" builds for this project. In order to allow automated tests to run, please ask one of the project maintainers to review the code and then do one of the following:
|
@@ -33,7 +33,7 @@ | |||
with_items: "{{ gluster.hosts }}" | |||
loop_control: | |||
loop_var: host | |||
when: gluster is defined and hosts in gluster and gluster.hosts | length > 1 | |||
when: gluster is defined and "hosts in gluster" and gluster.hosts | length > 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please compare it with line 19
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@gobindadas did you verified it ? |
[stirabos@t470s pr242]$ cat test.yaml
---
- hosts: localhost
connection: local
tasks:
- name: Include Host vars
include_vars: "vars.yaml"
- debug: var=gluster
- debug:
msg: "{{ 'Processing: ' + item }}"
with_items: "{{ gluster.hosts }}"
when: "gluster is defined and 'hosts' in gluster and gluster.hosts | length > 1"
[stirabos@t470s pr242]$ cat vars.yaml
gluster:
hosts:
rhsqa-grafton8-nic2.lab.eng.blr.redhat.com:
rhsqa-grafton9-nic2.lab.eng.blr.redhat.com:
vars:
storage_domains: [{"name":"data","host":"rhsqa-grafton7.lab.eng.blr.redhat.com","address":"rhsqa-grafton7.lab.eng.blr.redhat.com","path":"/data","mount_options":"backup-volfile-servers=rhsqa-grafton8.lab.eng.blr.redhat.com:rhsqa-grafton9.lab.eng.blr.redhat.com"},{"name":"vmstore","host":"rhsqa-grafton7.lab.eng.blr.redhat.com","address":"rhsqa-grafton7.lab.eng.blr.redhat.com","path":"/vmstore","mount_options":"backup-volfile-servers=rhsqa-grafton8.lab.eng.blr.redhat.com:rhsqa-grafton9.lab.eng.blr.redhat.com"}]
[stirabos@t470s pr242]$ ansible-playbook test.yaml -i localhost,
PLAY [localhost] *************************************************************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] *******************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [Include Host vars] *****************************************************************************************************************************************************************************************************************************************************************
ok: [localhost]
TASK [debug] *****************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] => {
"gluster": {
"hosts": {
"rhsqa-grafton8-nic2.lab.eng.blr.redhat.com": null,
"rhsqa-grafton9-nic2.lab.eng.blr.redhat.com": null
},
"vars": {
"storage_domains": [
{
"address": "rhsqa-grafton7.lab.eng.blr.redhat.com",
"host": "rhsqa-grafton7.lab.eng.blr.redhat.com",
"mount_options": "backup-volfile-servers=rhsqa-grafton8.lab.eng.blr.redhat.com:rhsqa-grafton9.lab.eng.blr.redhat.com",
"name": "data",
"path": "/data"
},
{
"address": "rhsqa-grafton7.lab.eng.blr.redhat.com",
"host": "rhsqa-grafton7.lab.eng.blr.redhat.com",
"mount_options": "backup-volfile-servers=rhsqa-grafton8.lab.eng.blr.redhat.com:rhsqa-grafton9.lab.eng.blr.redhat.com",
"name": "vmstore",
"path": "/vmstore"
}
]
}
}
}
TASK [debug] *****************************************************************************************************************************************************************************************************************************************************************************
ok: [localhost] => (item=rhsqa-grafton8-nic2.lab.eng.blr.redhat.com) => {
"msg": "Processing: rhsqa-grafton8-nic2.lab.eng.blr.redhat.com"
}
ok: [localhost] => (item=rhsqa-grafton9-nic2.lab.eng.blr.redhat.com) => {
"msg": "Processing: rhsqa-grafton9-nic2.lab.eng.blr.redhat.com"
}
PLAY RECAP *******************************************************************************************************************************************************************************************************************************************************************************
localhost : ok=4 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
|
@gobindadas can you please squash all the commits and rebase? |
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1746395
@tiraboschi @irosenzw Please review and merge.