mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
PostgreSQL Integration test suite: improvements (#23631)
* PostgreSQL tests: use package module * PostgreSQL tests: use ansible_service_mgr in order to test init system * PostgreSQL tests: fix a typo * PostgreSQL tests: install only required packages * PostgreSQL tests: use role default value when unchanged
This commit is contained in:
parent
9f56f87770
commit
bf5d87af07
8 changed files with 35 additions and 44 deletions
|
@ -44,26 +44,11 @@
|
|||
ignore_errors: True
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: install rpm dependencies for postgresql test
|
||||
package: name={{ postgresql_package_item }} state=latest
|
||||
- name: install dependencies for postgresql test
|
||||
package: name={{ postgresql_package_item }} state=present
|
||||
with_items: "{{ postgresql_packages }}"
|
||||
loop_control:
|
||||
loop_var: postgresql_package_item
|
||||
when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"
|
||||
|
||||
- name: install dpkg dependencies for postgresql test
|
||||
apt: name={{ postgresql_package_item }} state=latest
|
||||
with_items: "{{postgresql_packages}}"
|
||||
loop_control:
|
||||
loop_var: postgresql_package_item
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
|
||||
- name: install FreeBSD dependencies for postgresql test
|
||||
pkgng: name={{ postgresql_package_item }} state=present
|
||||
with_items: "{{postgresql_packages}}"
|
||||
loop_control:
|
||||
loop_var: postgresql_package_item
|
||||
when: ansible_os_family == "FreeBSD"
|
||||
|
||||
- name: initialize postgres (FreeBSD)
|
||||
command: /usr/local/etc/rc.d/postgresql oneinitdb
|
||||
|
@ -71,13 +56,13 @@
|
|||
|
||||
- name: Initialize postgres (RedHat systemd)
|
||||
command: postgresql-setup initdb
|
||||
when: ansible_distribution == "Fedora" or (ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 7)
|
||||
when: ansible_os_family == "RedHat" and ansible_service_mgr == "systemd"
|
||||
|
||||
- name: Initialize postgres (RedHat sysv)
|
||||
command: /sbin/service postgresql initdb
|
||||
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int <= 6
|
||||
when: ansible_os_family == "RedHat" and ansible_service_mgr != "systemd"
|
||||
|
||||
- name: Iniitalize postgres (Debian)
|
||||
- name: Initialize postgres (Debian)
|
||||
command: /usr/bin/pg_createcluster {{ pg_ver }} main
|
||||
# Sometimes package install creates the db cluster, sometimes this step is needed
|
||||
ignore_errors: True
|
||||
|
@ -103,17 +88,37 @@
|
|||
command: locale-gen es_ES
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: install i18ndata
|
||||
zypper: name=glibc-i18ndata state=present
|
||||
when: ansible_os_family == 'Suse'
|
||||
# Suse: locales are installed by default (glibc-locale package).
|
||||
# Fedora 23: locales are installed by default (glibc-common package)
|
||||
# CentOS: all locales are installed by default (glibc-common package) but some
|
||||
# RPM macros could prevent their installation (for example when using anaconda
|
||||
# instLangs parameter).
|
||||
|
||||
- name: Generate pt_BR locale (Red Hat)
|
||||
command: localedef -f ISO-8859-1 -i pt_BR pt_BR
|
||||
when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"
|
||||
- block:
|
||||
- name: Check if locales need to be generated (RedHat)
|
||||
shell: "localedef --list-archive | grep -a -q '^{{ locale }}$'"
|
||||
register: locale_present
|
||||
ignore_errors: True
|
||||
with_items:
|
||||
- es_ES
|
||||
- pt_BR
|
||||
loop_control:
|
||||
loop_var: locale
|
||||
|
||||
- name: Generate es_ES locale (Red Hat)
|
||||
command: localedef -f ISO-8859-1 -i es_ES es_ES
|
||||
when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"
|
||||
- name: Generate locale (RedHat)
|
||||
command: 'localedef -f ISO-8859-1 -i {{ item.locale }} {{ item.locale }}'
|
||||
when: item|failed
|
||||
with_items: '{{ locale_present.results }}'
|
||||
when: ansible_os_family == 'RedHat' and ansible_distribution != 'Fedora'
|
||||
|
||||
- name: Install glibc langpacks (Fedora >= 24)
|
||||
package:
|
||||
name: '{{ item }}'
|
||||
state: 'latest'
|
||||
with_items:
|
||||
- glibc-langpack-es
|
||||
- glibc-langpack-pt
|
||||
when: ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 24
|
||||
|
||||
- name: enable postgresql service (FreeBSD)
|
||||
lineinfile:
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
postgresql_service: "postgresql"
|
||||
|
||||
postgresql_packages:
|
||||
- "postgresql"
|
||||
- "postgresql-common"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
postgresql_service: "postgresql"
|
||||
|
||||
postgresql_packages:
|
||||
- "postgresql93-server"
|
||||
- "py27-psycopg2"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
postgresql_service: "postgresql"
|
||||
|
||||
postgresql_packages:
|
||||
- "postgresql"
|
||||
- "postgresql-common"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
postgresql_service: "postgresql"
|
||||
|
||||
postgresql_packages:
|
||||
- "postgresql"
|
||||
- "postgresql-common"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
postgresql_service: "postgresql"
|
||||
|
||||
postgresql_packages:
|
||||
- "postgresql"
|
||||
- "postgresql-common"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
postgresql_service: "postgresql"
|
||||
|
||||
postgresql_packages:
|
||||
- "postgresql"
|
||||
- "postgresql-common"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
postgresql_service: "postgresql"
|
||||
|
||||
postgresql_packages:
|
||||
- "postgresql-server"
|
||||
- "python-psycopg2"
|
||||
|
|
Loading…
Reference in a new issue