mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
New integration tests for postgresql
This commit is contained in:
parent
6570a6c6de
commit
7329bcde99
10 changed files with 1009 additions and 0 deletions
71
test/integration/roles/setup_postgresql_db/tasks/main.yml
Normal file
71
test/integration/roles/setup_postgresql_db/tasks/main.yml
Normal file
|
@ -0,0 +1,71 @@
|
|||
- include_vars: '{{ item }}'
|
||||
with_first_found:
|
||||
- files:
|
||||
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
|
||||
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
|
||||
- '{{ ansible_os_family }}.yml'
|
||||
- 'default.yml'
|
||||
paths: '../vars'
|
||||
|
||||
# Make sure we start fresh
|
||||
- name: remove rpm dependencies for postgresql test
|
||||
yum: name={{ item }} state=absent
|
||||
with_items: postgresql_packages
|
||||
when: ansible_pkg_mgr == 'yum'
|
||||
|
||||
- name: remove dpkg dependencies for postgresql test
|
||||
apt: name={{ item }} state=absent
|
||||
with_items: postgresql_packages
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
|
||||
- name: remove old db (red hat)
|
||||
command: rm -rf "{{ pg_dir }}"
|
||||
ignore_errors: True
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
# Theoretically, pg_dropcluster should work but it doesn't so rm files
|
||||
- name: remove old db config (debian)
|
||||
command: rm -rf /etc/postgresql
|
||||
ignore_errors: True
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: remove old db files (debian)
|
||||
command: rm -rf /var/lib/postgresql
|
||||
ignore_errors: True
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: install rpm dependencies for postgresql test
|
||||
yum: name={{ item }} state=latest
|
||||
with_items: postgresql_packages
|
||||
when: ansible_pkg_mgr == 'yum'
|
||||
|
||||
- name: install dpkg dependencies for postgresql test
|
||||
apt: name={{ item }} state=latest
|
||||
with_items: postgresql_packages
|
||||
when: ansible_pkg_mgr == 'apt'
|
||||
|
||||
- name: Initialize postgres (systemd)
|
||||
command: postgresql-setup initdb
|
||||
when: ansible_distribution == "Fedora" or (ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 7)
|
||||
|
||||
- name: Initialize postgres (sysv)
|
||||
command: /sbin/service postgresql initdb
|
||||
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int <= 6
|
||||
|
||||
- name: Iniitalize postgres (upstart)
|
||||
command: /usr/bin/pg_createcluster {{ pg_ver }} main
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Copy pg_hba into place
|
||||
copy: src=pg_hba.conf dest="{{ pg_hba_location }}" owner="postgres" group="root" mode="0644"
|
||||
|
||||
- name: Generate locale on Debian systems
|
||||
command: locale-gen pt_BR
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Generate locale on Debian systems
|
||||
command: locale-gen es_MX
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: restart postgresql service
|
||||
service: name={{ postgresql_service }} state=restarted
|
Loading…
Add table
Add a link
Reference in a new issue