Fix broken tests, add Debian 8 test.
This commit is contained in:
parent
9ef6bede6b
commit
e742492e45
10
.travis.yml
10
.travis.yml
|
@ -5,15 +5,23 @@ env:
|
||||||
- distro: centos7
|
- distro: centos7
|
||||||
init: /usr/lib/systemd/systemd
|
init: /usr/lib/systemd/systemd
|
||||||
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||||
|
postgres_bin_path: /usr/bin
|
||||||
- distro: centos6
|
- distro: centos6
|
||||||
init: /sbin/init
|
init: /sbin/init
|
||||||
run_opts: ""
|
run_opts: ""
|
||||||
|
postgres_bin_path: /usr/bin
|
||||||
- distro: ubuntu1604
|
- distro: ubuntu1604
|
||||||
init: /lib/systemd/systemd
|
init: /lib/systemd/systemd
|
||||||
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||||
|
postgres_bin_path: /usr/lib/postgresql/9.5/bin
|
||||||
- distro: ubuntu1404
|
- distro: ubuntu1404
|
||||||
init: /sbin/init
|
init: /sbin/init
|
||||||
run_opts: ""
|
run_opts: ""
|
||||||
|
postgres_bin_path: /usr/lib/postgresql/9.3/bin
|
||||||
|
- distro: debian8
|
||||||
|
init: /lib/systemd/systemd
|
||||||
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||||
|
postgres_bin_path: /usr/lib/postgresql/9.4/bin
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
@ -43,7 +51,7 @@ script:
|
||||||
|| (echo 'Idempotence test: fail' && exit 1)
|
|| (echo 'Idempotence test: fail' && exit 1)
|
||||||
|
|
||||||
# Check PostgreSQL status.
|
# Check PostgreSQL status.
|
||||||
- 'docker exec -u postgres "$(cat ${container_id})" pg_ctl -D /var/lib/pgsql/data status'
|
- 'docker exec -u postgres "$(cat ${container_id})" ${postgres_bin_path}/pg_ctl -D /var/lib/pgsql/data status'
|
||||||
|
|
||||||
after_failure:
|
after_failure:
|
||||||
# Check what happened on systemd systems.
|
# Check what happened on systemd systems.
|
||||||
|
|
|
@ -49,6 +49,13 @@ TODO.
|
||||||
role_attr_flags: CREATEDB,NOSUPERUSER # optional
|
role_attr_flags: CREATEDB,NOSUPERUSER # optional
|
||||||
state: present # optional
|
state: present # optional
|
||||||
|
|
||||||
|
TODO.
|
||||||
|
|
||||||
|
postgresql_version: [OS-specific]
|
||||||
|
postgresql_bin_path: [OS-specific]
|
||||||
|
postgresql_daemon: [OS-specific]
|
||||||
|
postgresql_packages: [OS-specific]
|
||||||
|
|
||||||
TODO.
|
TODO.
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: Set PGDATA environment variable.
|
- name: Set PostgreSQL environment variables.
|
||||||
template:
|
template:
|
||||||
src: postgres.sh.j2
|
src: postgres.sh.j2
|
||||||
dest: /etc/profile.d/postgres.sh
|
dest: /etc/profile.d/postgres.sh
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
register: pgdata_dir_version
|
register: pgdata_dir_version
|
||||||
|
|
||||||
- name: Ensure PostgreSQL database is initialized.
|
- name: Ensure PostgreSQL database is initialized.
|
||||||
command: "initdb -D {{ postgresql_data_dir }}"
|
command: "{{ postgresql_bin_path }}/initdb -D {{ postgresql_data_dir }}"
|
||||||
when: not pgdata_dir_version.stat.exists
|
when: not pgdata_dir_version.stat.exists
|
||||||
become: yes
|
become: yes
|
||||||
become_user: "{{ postgresql_user }}"
|
become_user: "{{ postgresql_user }}"
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
---
|
---
|
||||||
# Variable configuration.
|
# Variable configuration.
|
||||||
- name: Include OS-specific variables.
|
- name: Include OS-specific variables (Debian).
|
||||||
|
include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml"
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
- name: Include OS-specific variables (RedHat).
|
||||||
include_vars: "{{ ansible_os_family }}.yml"
|
include_vars: "{{ ansible_os_family }}.yml"
|
||||||
|
when: ansible_os_family == 'RedHat'
|
||||||
|
|
||||||
- name: Define postgresql_packages.
|
- name: Define postgresql_packages.
|
||||||
set_fact:
|
set_fact:
|
||||||
|
@ -12,3 +17,13 @@
|
||||||
set_fact:
|
set_fact:
|
||||||
postgresql_daemon: "{{ __postgresql_daemon }}"
|
postgresql_daemon: "{{ __postgresql_daemon }}"
|
||||||
when: postgresql_daemon is not defined
|
when: postgresql_daemon is not defined
|
||||||
|
|
||||||
|
- name: Define postgresql_version.
|
||||||
|
set_fact:
|
||||||
|
postgresql_version: "{{ __postgresql_version }}"
|
||||||
|
when: postgresql_version is not defined
|
||||||
|
|
||||||
|
- name: Define postgresql_bin_path.
|
||||||
|
set_fact:
|
||||||
|
postgresql_bin_path: "{{ __postgresql_bin_path }}"
|
||||||
|
when: postgresql_bin_path is not defined
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
export PGDATA={{ postgresql_data_dir }}
|
export PGDATA={{ postgresql_data_dir }}
|
||||||
|
export PATH=$PATH:{{ postgresql_bin_path }}
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
---
|
---
|
||||||
- hosts: all
|
- hosts: all
|
||||||
|
|
||||||
|
vars:
|
||||||
|
postgresql_databases:
|
||||||
|
- name: example
|
||||||
|
postgresql_users:
|
||||||
|
- name: jdoe
|
||||||
|
|
||||||
pre_tasks:
|
pre_tasks:
|
||||||
- name: Update apt cache.
|
- name: Update apt cache.
|
||||||
apt: update_cache=yes
|
apt: update_cache=yes
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
---
|
---
|
||||||
|
__postgresql_version: "9.5"
|
||||||
|
__postgresql_bin_path: "/usr/lib/postgresql/{{ __postgresql_version }}/bin"
|
||||||
__postgresql_daemon: postgresql
|
__postgresql_daemon: postgresql
|
||||||
__postgresql_packages:
|
__postgresql_packages:
|
||||||
- postgresql
|
- postgresql
|
|
@ -1,4 +1,6 @@
|
||||||
---
|
---
|
||||||
|
__postgresql_version: "9.2"
|
||||||
|
__postgresql_bin_path: "/usr/bin"
|
||||||
__postgresql_daemon: postgresql
|
__postgresql_daemon: postgresql
|
||||||
__postgresql_packages:
|
__postgresql_packages:
|
||||||
- postgresql
|
- postgresql
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
__postgresql_version: "9.5"
|
||||||
|
__postgresql_bin_path: "/usr/lib/postgresql/{{ __postgresql_version }}/bin"
|
||||||
|
__postgresql_daemon: postgresql
|
||||||
|
__postgresql_packages:
|
||||||
|
- postgresql
|
||||||
|
- postgresql-contrib
|
||||||
|
- libpq-dev
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
__postgresql_version: "9.5"
|
||||||
|
__postgresql_bin_path: "/usr/lib/postgresql/{{ __postgresql_version }}/bin"
|
||||||
|
__postgresql_daemon: postgresql
|
||||||
|
__postgresql_packages:
|
||||||
|
- postgresql
|
||||||
|
- postgresql-contrib
|
||||||
|
- libpq-dev
|
Loading…
Reference in New Issue