Skip to content

Instantly share code, notes, and snippets.

@madrobby
Last active November 18, 2020 13:00
Show Gist options
  • Save madrobby/9628514 to your computer and use it in GitHub Desktop.
Save madrobby/9628514 to your computer and use it in GitHub Desktop.
Ansible actions to install a PostgreSQL 9.3 database server on Ubuntu 12.04
- name: Add PostgreSQL repository
apt_repository: repo='deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main' state=present
sudo: yes
- name: Add PostgreSQL repository key
apt_key: url=https://www.postgresql.org/media/keys/ACCC4CF8.asc state=present
sudo: yes
- name: Update apt cache
apt: update_cache=yes
sudo: yes
# locale stuff forces installation to use UTF-8
- name: Install PostgreSQL server
shell: >
LANG={{ locale }} LC_COLLATE={{ locale }} LC_CTYPE={{ locale }}
LC_MESSAGES={{ locale }} LC_MONETARY={{ locale }}
LC_NUMERIC={{ locale }} LC_TIME={{ locale }}
LC_ALL={{ locale }}
apt-get install -y postgresql-9.3
sudo: yes
- name: Install PostgreSQL development library
apt: pkg=libpq-dev state=present
sudo: yes
- name: Restart postgresql server
service: name=postgresql state=started enabled=yes
sudo: yes
@lgfausak
Copy link

lgfausak commented Jun 4, 2016

nice, thanks...helped out a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment