|
2 | 2 | # tasks file for ansible-role-postgresql |
3 | 3 |
|
4 | 4 | - name: increase shared memory allocation size |
5 | | - sysctl: name=kern.sysv.shmall value=131072000 state=present |
| 5 | + become: yes |
| 6 | + sysctl: name=kern.sysv.shmall value=131072000 state=present reload=no sysctl_set=yes |
6 | 7 |
|
7 | 8 | - name: increase shared memory max |
8 | | - sysctl: name=kern.sysv.shmmax value=524288000 state=present |
| 9 | + become: yes |
| 10 | + sysctl: name=kern.sysv.shmmax value=524288000 state=present reload=no sysctl_set=yes |
9 | 11 |
|
10 | 12 | - name: install postgresql |
11 | 13 | homebrew: name=postgresql state=latest |
12 | 14 |
|
| 15 | +- name: install psycopg2 |
| 16 | + become: yes |
| 17 | + pip: name=psycopg2 |
| 18 | + |
13 | 19 | - name: blow away default image's data directory |
14 | | - file: path=/usr/local/var/postgres state=absent |
| 20 | + shell: rm -Rf /usr/local/var/postgres; |
| 21 | + args: |
| 22 | + creates: /usr/local/var/postgres/postgres-dbinit.done |
15 | 23 |
|
16 | 24 | - name: create the database |
17 | | - shell: /usr/local/bin/initdb -U postgres --encoding=utf8 --locale=en_US /usr/local/var/postgres |
| 25 | + shell: /usr/local/bin/initdb -U postgres -A trust --encoding=utf8 --locale=en_US /usr/local/var/postgres; touch /usr/local/var/postgres/postgres-dbinit.done; |
| 26 | + args: |
| 27 | + creates: /usr/local/var/postgres/postgres-dbinit.done |
| 28 | + |
| 29 | +- name: manage postgres directories |
| 30 | + become: yes |
| 31 | + file: |
| 32 | + path: "{{item}}" |
| 33 | + state: directory |
| 34 | + mode: 0700 |
| 35 | + with_items: |
| 36 | + - /usr/local/var/postgres/ |
18 | 37 |
|
19 | 38 | - name: install launchagents |
20 | | - file: src=/usr/local/opt/postgresql/homebrew.mxcl.percona-server.plist path=~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist state=link force=yes |
| 39 | + file: src=/usr/local/opt/postgresql/homebrew.mxcl.postgresql.plist path=~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist state=link force=yes |
21 | 40 |
|
22 | 41 | - name: check if postgresql is loaded |
23 | 42 | shell: launchctl list |
24 | 43 | changed_when: False |
25 | 44 | register: postgresql_loaded_result |
26 | 45 |
|
27 | | -- name: launch mysql |
| 46 | +- name: launch postgresql |
28 | 47 | shell: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist |
29 | 48 | when: "'homebrew.mxcl.postgresql' not in postgresql_loaded_result.stdout" |
30 | 49 |
|
|
0 commit comments