title: ansible postgresql module to create role and add database
body: <p>I am currently running the following commands</p>
  
  <pre><code> # su - postgres
   $ psql
   postgres=# create role user_name with login encrypted password 'password';
   postgres=# create database database_name owner user_name template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';
  </code></pre>
  
  <p>I wanted to make use of the <a href="http://docs.ansible.com/ansible/latest/list_of_database_modules.html#postgresql" rel="nofollow noreferrer">postgresql module in ansible</a> do so. </p>
  
  <p>So far, I have tried this </p>
  
  <pre><code>- name: create the "{{ ovirt_engine_dwh_db_name }}" db from the command line
    command: |
      psql -c "create role {{ ovirt_engine_dwh_db_user }} with login encrypted password '{{ ovirt_engine_dwh_db_password }}';"
      psql -c "create database {{ ovirt_engine_dwh_db_name }} owner {{ ovirt_engine_dwh_db_user }} template template0 encoding 'UTF8' lc_collate 'en_US.UTF-8' lc_ctype 'en_US.UTF-8';"
    become_user: postgres
  </code></pre>
  
  <p>But the error which comes if I try this is that the jinja2 templating does not substitute the variables which I have defined in <code>defaults/main.yml</code></p>