##### Issue Type:
Bug Report

##### Ansible Version:
1.8.2

##### Environment:
OSX 10.8.5

##### Summary:
Fact gathering fails when cloud module deletes server and roles play is 
called with a when conditional.

##### Steps To Reproduce:

Assuming utilization of a cloud module such as 'rax', you can set the count 
to 0 to remove the servers and then call out to roles, as such:
```
- name: Build an exact count of cloud servers with incremented names
  hosts: local
  gather_facts: False
  tasks:
    - name: Server build requests
      local_action:
        module: rax
        credentials: ~/.raxpub
        name: test%03d.example.org
        flavor: performance1-1
        image: ubuntu-1204-lts-precise-pangolin
        state: present
        count: 0
        exact_count: yes
        group: webservers
        wait: yes
      register: rax

- name: Setup nginx
  user: root
  hosts: webservers
  vars:
   operation: "{{ wsoperation }}"
  roles:
    - { role: nginx, when: operation == 'create' }
```
##### Expected Results:

It would expected that the when clause should trigger prior/during the 
gather facts call thus adhering to the conditional and passing tests.

I call this a bug because I assume no operations should happen for a play 
unless the conditional is met, this includes fact gathering. 

Besides having a separate playbook with duplicated server logic, which 
defeats the purpose of this modules benefits, I do not see a proper work 
around. 

##### Actual Results:
Gather facts is triggered before the when operation is analyzed causing 
failure.
```
fatal: [webser-backend01] => SSH encountered an unknown error during the 
connection
```


This was closed as 'not a bug', anyone have suggested work around?

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c7c00708-ffbb-45b0-ae7c-57ab35b8632a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to