Repository: ansible/ansible

Issue:
ec2 wait parameter incorrectly claims to only support 'running' state
_From @morganchristiansson on March 3, 2016 18:16_

##### Issue Type:
- Documentation Report
##### Plugin Name:

ec2
##### Ansible Version:

N/A
##### Summary:

Current documentation for wait parameter says:

> wait for the instance to be 'running' before returning.

Source: https://github.com/ansible/ansible-modules-core/blob/devel/cloud/amazon/ec2.py#L105

The actual code supports waiting for any state. https://github.com/ansible/ansible-modules-core/blob/devel/cloud/amazon/ec2.py#L1308

The actual check is on line 1315

``` python
 if i.state == state:
```
##### Steps To Reproduce:

Use documentation as reference when trying to stop an instance and wait for it to stop.
##### Expected Results:

Documentation correctly states that it will wait for instance to be in running or stopped state.
##### Actual Results:

Documentation states and implies that waiting for stopped state is not supported. Reproduced independently by 2 developers in my team, myself included.


_Copied from original issue: ansible/ansible-modules-core#3181_


Discussion:
_From @ansibot on July 31, 2016 18:54_

<!-- @morganchristiansson: Thanks for filing this documentation report! -->

@ansible ping, this issue is waiting for your response.
[click here for bot help](https://github.com/jctanner/ansibullbot/blob/ISSUE_TRIAGE_CLASS/ISSUE_HELP.md)

<!--- boilerplate: issue_bug_new --->

_From @ansibot on September 9, 2016 18:24_

@ansible, ping. This issue is still waiting on your response.
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)

<!--- boilerplate: issue_renotify_maintainer --->

_From @ansibot on October 6, 2016 14:57_

@ansible, ping. This issue is still waiting on your response.
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)

<!--- boilerplate: issue_renotify_maintainer --->

_From @ansibot on October 22, 2016 9:1_

@ansible, ping. This issue is still waiting on your response.
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)

<!--- boilerplate: issue_renotify_maintainer --->

_From @ansibot on November 6, 2016 9:56_

@ansible, ping. This issue is still waiting on your response.
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)

<!--- boilerplate: issue_renotify_maintainer --->

_From @ansibot on November 22, 2016 10:5_

@ansible, ping. This issue is still waiting on your response.
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: issue_renotify_maintainer --->

Resolving patch:
diff --git a/lib/ansible/modules/cloud/amazon/ec2.py b/lib/ansible/modules/cloud/amazon/ec2.py
--- a/lib/ansible/modules/cloud/amazon/ec2.py
+++ b/lib/ansible/modules/cloud/amazon/ec2.py
@@ -116,7 +116,7 @@
     aliases: []
   wait:
     description:
-      - wait for the instance to be 'running' before returning.  Does not wait for SSH, see 'wait_for' example for details.
+      - wait for the instance to reach its desired state before returning.  Does not wait for SSH, see 'wait_for' example for details.
     required: false
     default: "no"
     choices: [ "yes", "no" ]


Test patch: