Sha256: d29cb7640fb66c37a0ca18b7bd20a40f103c52ecaefa0f37b7029c46e443f564

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

---
- name: install dependencies
  action: apt pkg={{ item }} state=latest
  with_items:
    - python-apt
    - python-psycopg2
    - libpq-dev

- name: get postgres apt key
  apt_key: url=http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc

- name: add apt-get repository for latest postgres
  apt_repository: repo="deb http://apt.postgresql.org/pub/repos/apt/ {{ ansible_lsb.codename }}-pgdg main"

- name: install postgres
  apt: name=postgresql-{{ postgresql.version }} state=latest update_cache=true

- name: copy pg_hba.conf
  sudo: true
  template: src=pg_hba.conf dest=/etc/postgresql/{{ postgresql.version }}/main/pg_hba.conf

- name: set pg_hba.conf permissions
  sudo: true
  file: path=/etc/postgresql/{{ postgresql.version }}/main/pg_hba.conf owner=postgres group=postgres mode=0640

- name: start postgresql
  service: name=postgresql state=started 

- name: create db user
  postgresql_user: name={{ database.user }} password={{ database.password }} role_attr_flags=CREATEDB
  sudo_user: postgres

- name: create database
  postgresql_db: name={{ database.name }} owner={{ database.user }} encoding=unicode lc_collate=en_US.utf8 lc_ctype=en_US.utf8 template=template0
  sudo_user: postgres
  when: inventory_hostname == 'production_deploy'

- name: ensure postgres starts on a fresh reboot
  service: name=postgresql state=started enabled=yes

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails-ahoy-0.0.2 lib/generators/ahoy/templates/ansible/playbooks/roles/postgresql/tasks/main.yml
rails-ahoy-0.0.1 lib/generators/ahoy/templates/ansible/playbooks/roles/postgresql/tasks/main.yml