title: Using aws_secret in ansible
body: <p>I'm trying to retrieve password from aws secret manager using ansible 2.8 using lookup.</p>
  
  <p>Below things are not working for me:</p>
  
  <ol>
  <li>In .bashrc, I have exported region</li>
  <li>Ansible Environment Variables in task</li>
  <li>Setting up ansible variables in pre_tasks</li>
  </ol>
  
  <pre class="lang-yaml prettyprint-override"><code>- hosts: StagingApps
    remote_user: staging
    gather_facts: false
  
    tasks:
    - debug:
        var: "{{ lookup('aws_secret', 'staging_mongodb_pass', region='us-east-1') }}"
        msg: "{{ query('aws_secret', 'staging_mongodb_pass', region='us-east-1') }}"
        environment:
          region: 'us-east-1'
  </code></pre>
  
  <p>Error Message:</p>
  
  <blockquote>
    <p>FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'aws_secret'. Error was a , original message: 'Requested entry (plugin_type: lookup plugin: aws_secret setting: region ) was not defined in configuration.'"}</p>
  </blockquote>