Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Corrected condition to auto add additional hosts #242

Merged
merged 5 commits into from Aug 28, 2019

Conversation

gobindadas
Copy link

@ovirt-infra
Copy link

Hello contributor, thanks for submitting a PR for this project!

I am the bot who triggers "standard-CI" builds for this project.
As a security measure, I will not run automated tests on PRs that are not from white-listed contributors.

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:

  1. Type ci test please on this PR to trigger automated tests for it.
  2. Type ci add to whitelist on this PR to trigger automated tests for it and also add you to the contributor white-list so that your future PRs will be tested automatically. ( keep in mind this list might be overwritten if the job XML is refreshed, for permanent whitelisting, please follow Add generic test for service status #3 option )
  3. If you are planning to contribute to more than one project, maybe it's better to ask them to add you to the project organization, so you'll be able to run tests for all the organization's projects.

@@ -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
Copy link
Contributor

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@irosenzw
Copy link
Contributor

@gobindadas did you verified it ?

@tiraboschi
Copy link
Contributor

[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   

@tiraboschi
Copy link
Contributor

@gobindadas can you please squash all the commits and rebase?

@irosenzw irosenzw merged commit c23ca83 into oVirt:master Aug 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants