mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-27 12:51:25 -07:00
Migrate Linux CI roles to test targets. (#17997)
This commit is contained in:
parent
374e4348e4
commit
75e4645ee7
263 changed files with 53 additions and 53 deletions
|
@ -0,0 +1,5 @@
|
|||
postgresql_service: postgresql
|
||||
|
||||
postgresql_packages:
|
||||
- postgresql-server
|
||||
- python-psycopg2
|
|
@ -0,0 +1,10 @@
|
|||
# !!! This file managed by Ansible. Any local changes may be overwritten. !!!
|
||||
|
||||
# Database administrative login by UNIX sockets
|
||||
# note: you may wish to restrict this further later
|
||||
local all postgres trust
|
||||
|
||||
# TYPE DATABASE USER CIDR-ADDRESS METHOD
|
||||
local all all md5
|
||||
host all all 127.0.0.1/32 md5
|
||||
host all all ::1/128 md5
|
83
test/integration/targets/setup_postgresql_db/tasks/main.yml
Normal file
83
test/integration/targets/setup_postgresql_db/tasks/main.yml
Normal file
|
@ -0,0 +1,83 @@
|
|||
- 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 old db (RedHat or Suse)
|
||||
command: rm -rf "{{ pg_dir }}"
|
||||
ignore_errors: True
|
||||
when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"
|
||||
|
||||
# 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
|
||||
package: name={{ postgresql_package_item }} state=latest
|
||||
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: Initialize postgres (RedHat systemd)
|
||||
command: postgresql-setup initdb
|
||||
when: ansible_distribution == "Fedora" or (ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 7)
|
||||
|
||||
- name: Initialize postgres (RedHat sysv)
|
||||
command: /sbin/service postgresql initdb
|
||||
when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int <= 6
|
||||
|
||||
- name: Iniitalize 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
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Initialize postgres (Suse)
|
||||
service: name=postgresql state=restarted
|
||||
when: ansible_os_family == 'Suse'
|
||||
|
||||
- name: Copy pg_hba into place
|
||||
copy: src=pg_hba.conf dest="{{ pg_hba_location }}" owner="postgres" group="root" mode="0644"
|
||||
|
||||
- name: Generate pt_BR locale (Debian)
|
||||
command: locale-gen pt_BR
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Generate es_MX locale (Debian)
|
||||
command: locale-gen es_MX
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: install i18ndata
|
||||
zypper: name=glibc-i18ndata state=present
|
||||
when: ansible_os_family == 'Suse'
|
||||
|
||||
- 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"
|
||||
|
||||
- name: Generate es_MX locale (Red Hat)
|
||||
command: localedef -f ISO-8859-1 -i es_MX es_MX
|
||||
when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"
|
||||
|
||||
- name: restart postgresql service
|
||||
service: name={{ postgresql_service }} state=restarted
|
|
@ -0,0 +1,10 @@
|
|||
postgresql_service: "postgresql"
|
||||
|
||||
postgresql_packages:
|
||||
- "postgresql"
|
||||
- "postgresql-common"
|
||||
- "python-psycopg2"
|
||||
|
||||
pg_hba_location: "/etc/postgresql/9.4/main/pg_hba.conf"
|
||||
pg_dir: "/var/lib/postgresql/9.4/main"
|
||||
pg_ver: 9.4
|
|
@ -0,0 +1,11 @@
|
|||
postgresql_service: "postgresql"
|
||||
|
||||
postgresql_packages:
|
||||
- "postgresql"
|
||||
- "postgresql-common"
|
||||
- "python-psycopg2"
|
||||
|
||||
pg_hba_location: "/etc/postgresql/9.1/main/pg_hba.conf"
|
||||
pg_dir: "/var/lib/postgresql/9.1/main"
|
||||
pg_ver: 9.1
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
postgresql_service: "postgresql"
|
||||
|
||||
postgresql_packages:
|
||||
- "postgresql"
|
||||
- "postgresql-common"
|
||||
- "python-psycopg2"
|
||||
|
||||
pg_hba_location: "/etc/postgresql/9.3/main/pg_hba.conf"
|
||||
pg_dir: "/var/lib/postgresql/9.3/main"
|
||||
pg_ver: 9.3
|
|
@ -0,0 +1,10 @@
|
|||
postgresql_service: "postgresql"
|
||||
|
||||
postgresql_packages:
|
||||
- "postgresql"
|
||||
- "postgresql-common"
|
||||
- "python-psycopg2"
|
||||
|
||||
pg_hba_location: "/etc/postgresql/9.5/main/pg_hba.conf"
|
||||
pg_dir: "/var/lib/postgresql/9.5/main"
|
||||
pg_ver: 9.5
|
|
@ -0,0 +1,8 @@
|
|||
postgresql_service: "postgresql"
|
||||
|
||||
postgresql_packages:
|
||||
- "postgresql-server"
|
||||
- "python-psycopg2"
|
||||
|
||||
pg_hba_location: "/var/lib/pgsql/data/pg_hba.conf"
|
||||
pg_dir: "/var/lib/pgsql/data"
|
Loading…
Add table
Add a link
Reference in a new issue