<p dir="auto">Issue Type: Bug Report<br>
Ansible Version: ansible 1.7.2<br>
Environment: Arch Linux<br>
Summary: Variable content gets newlines duplicated when pasted into a file via the <code class="notranslate">copy</code> module<br>
Steps To Reproduce:</p>
<ul dir="auto">
<li>Add a step <code class="notranslate">copy: content="{{ ssl_private_key }}" dest=/etc/ssl/private/foo.pem</code> in a playbook</li>
<li>Write the content of <em>ssl_private_key</em> in an ansible-vault vars file</li>
<li>Run the playbook</li>
<li>Check if /etc/ssl/private/foo.pem will have an extra newline for each line in the ssl_private_key variable</li>
</ul>
<p dir="auto">Expected Results: if the variable <em>ssl_private_key</em> is defined like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ssl_private_key: |
   -----BEGIN PRIVATE KEY-----
   MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDHI2RnhLTBOuZ0
   MQswCQYDVQQGEwJVUzEQMA4GA1UEChMHU1NMLmNvbTEcMBoGA1UEAxMTU1NMLmNv
   ZW50aWFsU1NMIFdpbGRjYXJkMRQwEgYDVQQDFAsqLnJlbGF5ci5pbzCCASIwDQYJ
   -----END PRIVATE KEY-----"><pre class="notranslate"><code class="notranslate">ssl_private_key: |
   -----BEGIN PRIVATE KEY-----
   MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDHI2RnhLTBOuZ0
   MQswCQYDVQQGEwJVUzEQMA4GA1UEChMHU1NMLmNvbTEcMBoGA1UEAxMTU1NMLmNv
   ZW50aWFsU1NMIFdpbGRjYXJkMRQwEgYDVQQDFAsqLnJlbGF5ci5pbzCCASIwDQYJ
   -----END PRIVATE KEY-----
</code></pre></div>
<p dir="auto">I expect to have this in /etc/ssl/private/foo.pem:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDHI2RnhLTBOuZ0
MQswCQYDVQQGEwJVUzEQMA4GA1UEChMHU1NMLmNvbTEcMBoGA1UEAxMTU1NMLmNv
ZW50aWFsU1NMIFdpbGRjYXJkMRQwEgYDVQQDFAsqLnJlbGF5ci5pbzCCASIwDQYJ
-----END PRIVATE KEY-----"><pre class="notranslate"><code class="notranslate">-----BEGIN PRIVATE KEY-----
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDHI2RnhLTBOuZ0
MQswCQYDVQQGEwJVUzEQMA4GA1UEChMHU1NMLmNvbTEcMBoGA1UEAxMTU1NMLmNv
ZW50aWFsU1NMIFdpbGRjYXJkMRQwEgYDVQQDFAsqLnJlbGF5ci5pbzCCASIwDQYJ
-----END PRIVATE KEY-----
</code></pre></div>
<p dir="auto">And <strong>this is what I actually get with Ansible 1.7.1 and some previous versions</strong>.</p>
<p dir="auto">Actual Results: But instead, <strong>with Ansible 1.7.2</strong> the result will have duplicated \n:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="-----BEGIN PRIVATE KEY-----

MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDHI2RnhLTBOuZ0

MQswCQYDVQQGEwJVUzEQMA4GA1UEChMHU1NMLmNvbTEcMBoGA1UEAxMTU1NMLmNv

ZW50aWFsU1NMIFdpbGRjYXJkMRQwEgYDVQQDFAsqLnJlbGF5ci5pbzCCASIwDQYJ

-----END PRIVATE KEY-----"><pre class="notranslate"><code class="notranslate">-----BEGIN PRIVATE KEY-----

MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDHI2RnhLTBOuZ0

MQswCQYDVQQGEwJVUzEQMA4GA1UEChMHU1NMLmNvbTEcMBoGA1UEAxMTU1NMLmNv

ZW50aWFsU1NMIFdpbGRjYXJkMRQwEgYDVQQDFAsqLnJlbGF5ci5pbzCCASIwDQYJ

-----END PRIVATE KEY-----
</code></pre></div>
<p dir="auto">From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/morganchristiansson/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/morganchristiansson">@morganchristiansson</a> on 2016-03-03T18:16:26Z</p>
<h5 dir="auto">Issue Type:</h5>
<ul dir="auto">
<li>Documentation Report</li>
</ul>
<h5 dir="auto">Component Name:</h5>
<p dir="auto">ec2</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">Current documentation for wait parameter says:</p>
<blockquote>
<p dir="auto">wait for the instance to be 'running' before returning.</p>
</blockquote>
<p dir="auto">Source: <a href="https://github.com/ansible/ansible-modules-core/blob/devel/cloud/amazon/ec2.py#L105">https://github.com/ansible/ansible-modules-core/blob/devel/cloud/amazon/ec2.py#L105</a></p>
<p dir="auto">The actual code supports waiting for any state. <a href="https://github.com/ansible/ansible-modules-core/blob/devel/cloud/amazon/ec2.py#L1308">https://github.com/ansible/ansible-modules-core/blob/devel/cloud/amazon/ec2.py#L1308</a></p>
<p dir="auto">The actual check is on line 1315</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" if i.state == state:"><pre class="notranslate"> <span class="pl-k">if</span> <span class="pl-s1">i</span>.<span class="pl-s1">state</span> <span class="pl-c1">==</span> <span class="pl-s1">state</span>:</pre></div>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">Use documentation as reference when trying to stop an instance and wait for it to stop.</p>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">Documentation correctly states that it will wait for instance to be in running or stopped state.</p>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto">Documentation states and implies that waiting for stopped state is not supported. Reproduced independently by 2 developers in my team, myself included.</p>
<p dir="auto">Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="138256248" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/3181" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/3181/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/3181">ansible/ansible-modules-core#3181</a></p>