title: awsli query ec2 to list IP then update values in ansible hosts file
body: <p>We have dynamically changing environment in AWS, everyday part of EC2`s most in ASG are shutting down (lambda) and they spin up (lambda) next day with different IPs.
  Would like to get new IPs everyday and update my local ansible hosts file with propper IP addresses (hostnames are not changing).</p>
  <p>First part is easy with aws-cli and command:</p>
  <pre><code>aws ec2 describe-instances --query 'Reservations[].Instances[].[PrivateIpAddress,Tags[?Key==`Name`]| [0].Value]' --output text &gt; text.txt
  </code></pre>
  <p>Second part is not :)
  Would like to update my ansible hosts file with new values from my text.txt file.</p>
  <p>My ansible hosts file looks like this:</p>
  <pre><code>servername1 ansible_host=IP
  servername2 ansible_host=IP
  servername3 ansible_host=IP
  ...
  servernameN ansible_host=IP
  </code></pre>
  <p>Can you help me guys write i assume python script witch will read text.txt and update new IP addresses if there`s a match (e.g. servername1 from text.txt = same entry in hosts file to propper ansible_host=IP ?</p>