main.yml 903 Bytes
Newer Older
1 2 3 4 5 6 7 8
---
# file: roles/quartz_scheduler/tasks/main.yml

- name: Create the Postgresql Database
  postgresql_db: name={{ db_name }}
                 encoding='UTF-8'
  become_user: postgres

9 10 11 12 13 14 15 16 17 18 19 20 21
- name: create password file on vagrant box
  become: true
  become_user: postgres
  lineinfile:
    dest: ~/.pgpass
    state: present
    create: yes
    line: "{{ item }}"
    mode: 0600
  with_items:
      - "#hostname:port:database:username:password"
      - "localhost:5432:{{ db_name }}:{{ db_user }}:{{ db_user_pw }}"

22 23 24 25 26 27 28 29 30 31 32 33
- name: Copy Quartz Table Creation Script
  become: true
  become_user: postgres
  copy: src=../files/quartz_tables_postgres.sql
        dest=~
        owner=postgres
        group=postgres
        mode=0775

- name: Creating Quartz Tables
  become: true
  become_user: postgres
34
  command: "psql -U vagrant -w -f {{ item }} -d {{ db_name }}"
35 36
  with_items: 
   - ~/quartz_tables_postgres.sql