Skip to content

Commit 8606926

Browse files
author
Roderik van der Veer
committed
Install en setup Postgresql
1 parent c23bff7 commit 8606926

File tree

6 files changed

+39
-41
lines changed

6 files changed

+39
-41
lines changed

README.md

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,23 @@
1-
Role Name
2-
=========
1+
# superlumic-ppostgresql
32

4-
A brief description of the role goes here.
3+
Ansible role to install and configure Postgresql on OSX. This role is part of the Superlumic project that aims to simplify repeat computer setups on OSX, 10.10 and up.
54

6-
Requirements
7-
------------
5+
## Requirements
86

9-
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
7+
* OSX 10.10 or 10.11
108

11-
Role Variables
12-
--------------
9+
## Dependencies
1310

14-
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
11+
* [roderik.superlumic-homebrew](https://github.com/superlumic/ansible-role-homebrew)
1512

16-
Dependencies
17-
------------
13+
# Usage
1814

19-
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
15+
Check [Superlumic](https://github.com/superlumic/superlumic) for documentation
2016

21-
Example Playbook
22-
----------------
17+
# License
2318

24-
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
19+
MIT
2520

26-
- hosts: servers
27-
roles:
28-
- { role: username.rolename, x: 42 }
21+
# Author
2922

30-
License
31-
-------
32-
33-
BSD
34-
35-
Author Information
36-
------------------
37-
38-
An optional section for the role authors to include contact information, or a website (HTML is not allowed).
23+
[Roderik van der Veer](mailto:roderik@superlumic.com) - [@r0derik](https://twitter.com/r0derik)

defaults/main.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

handlers/main.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

meta/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
galaxy_info:
33
author: Roderik van der Veer
4-
description: Ansible role to setup postgresql
4+
description: Ansible role to install and configure Postgresql on OSX. This role is part of the Superlumic project that aims to simplify repeat computer setups on OSX, 10.10 and up.
55
license: MIT
66
min_ansible_version: 1.2
77
platforms:
@@ -11,4 +11,4 @@ galaxy_info:
1111
categories:
1212
- system
1313
dependencies:
14-
- homebrew
14+
- roderik.superlumic-homebrew

tasks/main.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,48 @@
22
# tasks file for ansible-role-postgresql
33

44
- 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
67

78
- 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
911

1012
- name: install postgresql
1113
homebrew: name=postgresql state=latest
1214

15+
- name: install psycopg2
16+
become: yes
17+
pip: name=psycopg2
18+
1319
- 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
1523

1624
- 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/
1837

1938
- 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
2140

2241
- name: check if postgresql is loaded
2342
shell: launchctl list
2443
changed_when: False
2544
register: postgresql_loaded_result
2645

27-
- name: launch mysql
46+
- name: launch postgresql
2847
shell: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
2948
when: "'homebrew.mxcl.postgresql' not in postgresql_loaded_result.stdout"
3049

vars/main.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)