diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be8670f68..f14d1c76b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,26 +17,26 @@ defaults: jobs: -# lint: -# name: Lint -# runs-on: ubuntu-latest -# steps: -# - name: Check out the codebase. -# uses: actions/checkout@v2 -# with: -# path: 'postgresql' -# -# - name: Set up Python 3. -# uses: actions/setup-python@v2 -# with: -# python-version: '3.x' -# -# - name: Install test dependencies. -# run: pip3 install yamllint -# -# - name: Lint code. -# run: | -# yamllint . + lint: + name: Yamllint + runs-on: ubuntu-latest + steps: + - name: Check out the codebase. + uses: actions/checkout@v4 + with: + path: 'postgresql' + + - name: Set up Python 3. + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install test dependencies. + run: pip3 install yamllint + + - name: Lint code. + run: | + yamllint . molecule: name: Molecule @@ -44,14 +44,8 @@ jobs: strategy: matrix: include: - - distro: centos8 - - distro: debian9 - - distro: debian10 + - distro: rockylinux8 - distro: debian11 - - distro: fedora37 - - distro: ubuntu1604 - - distro: ubuntu1804 - - distro: ubuntu2004 - distro: ubuntu2204 steps: diff --git a/.yamllint b/.yamllint new file mode 100644 index 000000000..748379589 --- /dev/null +++ b/.yamllint @@ -0,0 +1,35 @@ +--- + +yaml-files: + - '*.yaml' + - '*.yml' + - '.yamllint' + +rules: + braces: disable + brackets: disable + colons: disable + commas: disable + comments: disable + comments-indentation: disable + document-end: disable + document-start: disable + empty-lines: + max: 1 + max-start: 1 + max-end: 1 + empty-values: + forbid-in-block-mappings: true + forbid-in-flow-mappings: true + hyphens: + max-spaces-after: 1 + indentation: disable + key-duplicates: disable + key-ordering: disable + line-length: disable + new-line-at-end-of-file: enable + new-lines: disable + octal-values: disable + quoted-strings: disable + trailing-spaces: enable + truthy: disable diff --git a/README.md b/README.md index 22abfe837..c1c886b60 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ An example how to include this role as a task: | Ubuntu 18.04.x | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |:grey_question: | :grey_question: | | Ubuntu 20.04.x | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |:grey_question: | :grey_question: | | Ubuntu 22.04.x | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |:grey_question: | :white_check_mark: | +| Rockylinux 9.x | :grey_question: | :grey_question: | :grey_question: | :grey_question: |:white_check_mark: | :white_check_mark: | | Fedora 37 | :grey_question: | :grey_question: | :grey_question: | :grey_question: |:grey_question: | :grey_question: | - :white_check_mark: - tested, works fine @@ -179,6 +180,7 @@ Maintainers: - [Greg Clough](https://github.com/gclough) - [Magnus Lübeck](https://github.com/maglub) - [Leo C.](https://github.com/MrMegaNova) +- [Laurent Lavaud](https://github.com/fidelio33b) Top Contributors: - [David Farrington](https://github.com/farridav) diff --git a/Vagrantfile b/Vagrantfile index 45c2b89cc..2eeb91ef6 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,46 +7,11 @@ Vagrant.configure('2') do |config| config.ssh.insert_key = false config.ssh.private_key_path = '~/.vagrant.d/insecure_private_key' - # - # DISABLED - # - # config.vm.define 'ubuntu16.local' do |machine| - # - # machine.vm.box = "bento/ubuntu-16.04" - # machine.vm.network :private_network, ip: '192.168.88.10' - # machine.vm.hostname = 'ubuntu16.local' - # - # machine.vm.provision 'ansible' do |ansible| - # ansible.playbook = 'tests/playbook.yml' - # ansible.verbose = "vvv" - # ansible.become = true - # ansible.inventory_path = 'vagrant-inventory' - # ansible.host_key_checking = false - # end - # - # end + config.vm.define 'jammy64.local' do |machine| - config.vm.define 'jessie64.local' do |machine| - - machine.vm.box = "debian/jessie64" - machine.vm.network :private_network, ip: '192.168.88.20' - machine.vm.hostname = 'jessie64.local' - - machine.vm.provision 'ansible' do |ansible| - ansible.playbook = 'tests/playbook.yml' - ansible.verbose = "vvv" - ansible.become = true - ansible.inventory_path = 'vagrant-inventory' - ansible.host_key_checking = false - end - - end - - config.vm.define 'wheezy64.local' do |machine| - - machine.vm.box = "debian/wheezy64" - machine.vm.network :private_network, ip: '192.168.88.21' - machine.vm.hostname = 'wheezy64.local' + machine.vm.box = "ubuntu/jammy64" + machine.vm.network :private_network, ip: '192.168.88.22' + machine.vm.hostname = 'jammy64.local' machine.vm.provision 'ansible' do |ansible| ansible.playbook = 'tests/playbook.yml' @@ -58,39 +23,4 @@ Vagrant.configure('2') do |config| end - config.vm.define 'centos7.local' do |machine| - - machine.vm.box = "centos/7" - machine.vm.network :private_network, ip: '192.168.88.30' - machine.vm.hostname = 'centos7.local' - - machine.vm.provision 'ansible' do |ansible| - ansible.playbook = 'tests/playbook.yml' - ansible.verbose = "vvv" - ansible.become = true - ansible.inventory_path = 'vagrant-inventory' - ansible.host_key_checking = false - end - - end - -## -## Fedora is disabled, as the build fails -## -## config.vm.define 'fedora27.local' do |machine| -## -## machine.vm.box = "fedora/27-cloud-base" -## machine.vm.network :private_network, ip: '192.168.88.40' -## machine.vm.hostname = 'fedora27.local' -## -## machine.vm.provision 'ansible' do |ansible| -## ansible.playbook = 'tests/playbook.yml' -## ansible.verbose = "vvv" -## ansible.become = true -## ansible.inventory_path = 'vagrant-inventory' -## ansible.host_key_checking = false -## end -## -## end - end diff --git a/defaults/main.yml b/defaults/main.yml index 0d067081b..7d362cb74 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -39,6 +39,7 @@ postgresql_database_owner: "{{ postgresql_admin_user }}" postgresql_ext_install_contrib: no postgresql_ext_install_dev_headers: no postgresql_ext_install_postgis: no +postgresql_ext_install_extra_packages: no # PostGIS postgresql_postgis_release_compatibility: @@ -178,13 +179,11 @@ postgresql_ssl_ca_file: "" # (>= 9.2) postgresql_ssl_crl_file: "" # (>= 9.2) postgresql_ssl_crl_dir: "" # (>= 14) - #------------------------------------------------------------------------------ # RESOURCE USAGE (except WAL) #------------------------------------------------------------------------------ # - Memory - - postgresql_shared_buffers: 128MB # min 128kB postgresql_huge_pages: "try" # on, off, or try postgresql_huge_page_size: 0 # (>= 14) @@ -233,7 +232,7 @@ postgresql_vacuum_cost_limit: 200 # 1-10000 credits postgresql_bgwriter_delay: 200ms # 10-10000ms between rounds postgresql_bgwriter_lru_maxpages: 100 # 0-1000 max buffers written/round postgresql_bgwriter_lru_multiplier: 2.0 # 0-10.0 multiplier on buffers scanned/round -postgresql_bgwriter_flush_after: 512kB # measured in pages, 0 disables +postgresql_bgwriter_flush_after: 512kB # measured in pages, 0 disables # - Asynchronous Behavior - @@ -248,7 +247,6 @@ postgresql_parallel_leader_participation: on # (>= 11) postgresql_old_snapshot_threshold: -1 # (>= 9.6) 1min-60d; -1 disables; 0 is immediate # (change requires restart) - #------------------------------------------------------------------------------ # WRITE-AHEAD LOG #------------------------------------------------------------------------------ @@ -275,9 +273,7 @@ postgresql_wal_skip_threshold: 2MB # (>= 13) postgresql_commit_delay: 0 # range 0-100000, in microseconds postgresql_commit_siblings: 5 # range 1-1000 - # - Checkpoints - - postgresql_max_wal_size: 1GB # (>= 9.5) postgresql_min_wal_size: 80MB # (>= 9.5) postgresql_checkpoint_flush_after: 0 # (>= 9.6) 0 disables, @@ -287,12 +283,10 @@ postgresql_checkpoint_completion_target: 0.5 # checkpoint target duration, 0.0 postgresql_checkpoint_warning: 30s # 0 disables # - Prefetching during recovery - - postgresql_recovery_prefetch: try # (>= 15) postgresql_wal_decode_buffer_size: 512kB # (>= 15) # - Archiving - - postgresql_archive_mode: "off" postgresql_archive_library: "" # (>= 15) # Command to use to archive a logfile segment. @@ -304,17 +298,13 @@ postgresql_archive_command: "" postgresql_archive_timeout: 0 # - Archive Recovery - - # These are only used in recovery mode. - postgresql_restore_command: "" # (>= 12) postgresql_archive_cleanup_command: "" # (>= 12) postgresql_recovery_end_command: "" # (>= 12) # - Recovery Target - - # Set these only when performing a targeted recovery. - postgresql_recovery_target: "" # (>= 12) postgresql_recovery_target_name: "" # (>= 12) postgresql_recovery_target_time: "" # (>= 12) @@ -324,15 +314,11 @@ postgresql_recovery_target_inclusive: "" # (>= 12) postgresql_recovery_target_timeline: "latest" # (>= 12) postgresql_recovery_target_action: "pause" # (>= 12) - #------------------------------------------------------------------------------ # REPLICATION #------------------------------------------------------------------------------ - # - Sending Servers - - # Set these on the primary and on any standby that will send replication data. - # max number of walsender processes postgresql_max_wal_senders: 10 postgresql_max_replication_slots: 0 # max number of replication slots @@ -345,9 +331,7 @@ postgresql_wal_sender_timeout: 60s # in milliseconds; 0 disables (>= 9.3) postgresql_track_commit_timestamp: off # (>= 9.5) # - Primary Server - - # These settings are ignored on a standby server. - # standby servers that provide sync rep. # number of sync standbys (>= 9.6) and comma-separated list of application_name from standby(s) postgresql_synchronous_standby_names: [] # '*' means 'all' @@ -357,9 +341,7 @@ postgresql_synchronous_standby_choose_sync: "FIRST" # >= 10 postgresql_vacuum_defer_cleanup_age: 0 # - Standby Servers - - # These settings are ignored on a primary server. - postgresql_primary_conninfo: "" # (>= 12) postgresql_primary_slot_name: "" # (>= 12) postgresql_promote_trigger_file: "" # (>= 12) @@ -381,20 +363,15 @@ postgresql_wal_retrieve_retry_interval: 5s # (>= 9.5) postgresql_recovery_min_apply_delay: 0 # (>= 12) # - Subscribers - (>= 10) - # These settings are ignored on a publisher. - postgresql_max_logical_replication_workers: 4 # (>= 10) taken from max_worker_processes # (change requires restart) postgresql_max_sync_workers_per_subscription: 2 # (>= 10) taken from max_logical_replication_workers - #------------------------------------------------------------------------------ # QUERY TUNING #------------------------------------------------------------------------------ - # - Planner Method Configuration - - postgresql_enable_async_append: on # (>= 14) postgresql_enable_bitmapscan: on postgresql_enable_gathermerge: on # (>= 14) @@ -417,7 +394,6 @@ postgresql_enable_sort: on postgresql_enable_tidscan: on # - Planner Cost Constants - - postgresql_seq_page_cost: 1.0 # measured on an arbitrary scale postgresql_random_page_cost: 4.0 # same scale as above postgresql_cpu_tuple_cost: 0.01 # same scale as above @@ -435,7 +411,6 @@ postgresql_jit_inline_above_cost: 500000 # inline small functions if query postgresql_jit_optimize_above_cost: 500000 # use expensive JIT optimizations if # - Genetic Query Optimizer - - postgresql_geqo: on postgresql_geqo_threshold: 12 postgresql_geqo_effort: 5 # range 1-10 @@ -444,9 +419,7 @@ postgresql_geqo_generations: 0 # selects default based on effort postgresql_geqo_selection_bias: 2.0 # range 1.5-2.0 postgresql_geqo_seed: 0.0 # range 0.0-1.0 - # - Other Planner Options - - postgresql_default_statistics_target: 100 # range 1-10000 postgresql_constraint_exclusion: "partition" # on, off, or partition postgresql_cursor_tuple_fraction: 0.1 # range 0.0-1.0 @@ -457,13 +430,10 @@ postgresql_force_parallel_mode: off # on, off, regress (>= 9.6 < postgresql_plan_cache_mode: "auto" # (>= 12) postgresql_recursive_worktable_factor: 10.0 # (>= 15) range 0.001-1000000 - #------------------------------------------------------------------------------ # REPORTING AND LOGGING #------------------------------------------------------------------------------ - # - Where to Log - - # Valid values are combinations of stderr, csvlog, syslog, and eventlog. # depending on platform. Csvlog requires logging_collector to be on. postgresql_log_destination: "stderr" @@ -497,7 +467,6 @@ postgresql_syslog_split_messages: on # (>= 9.6) # This is only relevant when logging to eventlog (win32) (>= 9.2): postgresql_event_source: "PostgreSQL" - # - When to Log - # Values in order of decreasing detail: @@ -588,14 +557,12 @@ postgresql_log_replication_commands: off postgresql_log_temp_files: -1 postgresql_log_timezone: "UTC" - #------------------------------------------------------------------------------ # PROCESS TITLE #------------------------------------------------------------------------------ postgresql_update_process_title: on # (>= 9.2) - #------------------------------------------------------------------------------ # STATISTICS #------------------------------------------------------------------------------ @@ -611,16 +578,13 @@ postgresql_track_functions: "none" # none, pl, all postgresql_stats_fetch_consistency: cache # (>= 15) postgresql_stats_temp_directory: "pg_stat_tmp" # (<= 14) - # - Monitoring - - postgresql_compute_query_id: auto # (>= 14) auto, on, off postgresql_log_parser_stats: off postgresql_log_planner_stats: off postgresql_log_executor_stats: off postgresql_log_statement_stats: off - #------------------------------------------------------------------------------ # AUTOVACUUM #------------------------------------------------------------------------------ @@ -652,7 +616,6 @@ postgresql_autovacuum_vacuum_cost_delay: 2ms # (<= 11: 20ms, >=12 2ms) # default vacuum cost limit for autovacuum, postgresql_autovacuum_vacuum_cost_limit: -1 - #------------------------------------------------------------------------------ # CLIENT CONNECTION DEFAULTS #------------------------------------------------------------------------------ @@ -745,11 +708,10 @@ postgresql_jit_provider: "llvmjit" # - Other Defaults - postgresql_dynamic_library_path: "$libdir" -postgresql_extension_destdir: "" # (>= 14) +postgresql_extension_destdir: "" # (>= 14) postgresql_gin_fuzzy_search_limit: 0 # (<= 9.2) - #------------------------------------------------------------------------------ # LOCK MANAGEMENT #------------------------------------------------------------------------------ @@ -767,7 +729,6 @@ postgresql_max_pred_locks_per_relation: -2 # (>= 10) negative values mean # / -max_pred_locks_per_relation) - 1 postgresql_max_pred_locks_per_page: 2 # (>= 10) min 0 - #------------------------------------------------------------------------------ # VERSION AND PLATFORM COMPATIBILITY #------------------------------------------------------------------------------ @@ -789,7 +750,6 @@ postgresql_sql_inheritance: on # (<= 9.6) postgresql_transform_null_equals: off - #------------------------------------------------------------------------------ # ERROR HANDLING #------------------------------------------------------------------------------ @@ -802,7 +762,6 @@ postgresql_restart_after_crash: on postgresql_data_sync_retry: off postgresql_recovery_init_sync_method: fsync #(>= 14) fsync, syncfs (Linux 5.8+) - #------------------------------------------------------------------------------ # CONFIG FILE INCLUDES #------------------------------------------------------------------------------ @@ -815,7 +774,6 @@ postgresql_include_if_exists: false # include file postgresql_include: false - #------------------------------------------------------------------------------ # PGTUNE #------------------------------------------------------------------------------ @@ -828,7 +786,6 @@ postgresql_pgtune_type: "Mixed" # Maximum number of expected connections, if "no", default based on db type postgresql_pgtune_connections: no - #------------------------------------------------------------------------------ # INSTALL/REPO #------------------------------------------------------------------------------ @@ -858,3 +815,5 @@ postgresql_dnf_repository_gpgkey: "{{ postgresql_yum_repository_gpgkey }}" postgresql_apt_py3_dependencies: ["python3-psycopg2", "locales"] postgresql_apt_py2_dependencies: ["python-psycopg2", "python-pycurl", "locales"] postgresql_apt_dependencies: "{{ postgresql_apt_py3_dependencies if 'python3' in ansible_python_interpreter|default('') else postgresql_apt_py2_dependencies }}" + +postgresql_hide_passwords: false diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 734ad6492..5e3e93250 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -8,48 +8,46 @@ lint: | # yamllint . # ansible-lint platforms: - - name: postgresql-10 - image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest" - command: "" - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:rw - privileged: true - pre_build_image: true - name: postgresql-11 - image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest" - command: "" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest" volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true pre_build_image: true + cgroupns_mode: host + command: ${MOLECULE_DOCKER_COMMAND:-""} - name: postgresql-12 - image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest" - command: "" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest" volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true pre_build_image: true + cgroupns_mode: host + command: ${MOLECULE_DOCKER_COMMAND:-""} - name: postgresql-13 - image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest" - command: "" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest" volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true pre_build_image: true + cgroupns_mode: host + command: ${MOLECULE_DOCKER_COMMAND:-""} - name: postgresql-14 image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest" - command: "" volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true pre_build_image: true + cgroupns_mode: host + command: ${MOLECULE_DOCKER_COMMAND:-""} - name: postgresql-15 image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest" - command: "" volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true pre_build_image: true + cgroupns_mode: host + command: ${MOLECULE_DOCKER_COMMAND:-""} provisioner: name: ansible config_options: @@ -60,8 +58,6 @@ provisioner: converge: ${MOLECULE_PLAYBOOK:-../../tests/playbook.yml} inventory: host_vars: - postgresql-10: - postgresql_version: 10 postgresql-11: postgresql_version: 11 postgresql-12: diff --git a/tasks/configure.yml b/tasks/configure.yml index c9ce93b60..ac0a03cf5 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -142,6 +142,7 @@ owner: "{{ postgresql_service_user }}" group: "{{ postgresql_service_group }}" mode: 0640 + no_log: "{{ postgresql_hide_passwords }}" register: postgresql_configuration_pt1 - name: PostgreSQL | Update configuration - pt. 2 (postgresql.conf) diff --git a/tasks/extensions.yml b/tasks/extensions.yml index e7baac77c..fb7ad8864 100644 --- a/tasks/extensions.yml +++ b/tasks/extensions.yml @@ -6,3 +6,5 @@ when: postgresql_ext_install_dev_headers - import_tasks: extensions/postgis.yml when: postgresql_ext_install_postgis +- import_tasks: extensions/extra_packages.yml + when: postgresql_ext_install_extra_packages diff --git a/tasks/extensions/dev_headers.yml b/tasks/extensions/dev_headers.yml index 5cfb70a06..343a51bd6 100644 --- a/tasks/extensions/dev_headers.yml +++ b/tasks/extensions/dev_headers.yml @@ -11,11 +11,11 @@ - restart postgresql - name: PostgreSQL | Extensions | Make sure the development headers are installed | RedHat - yum: + yum: name: - "postgresql{{ postgresql_version_terse }}-libs" - "postgresql{{ postgresql_version_terse }}-devel" - state: present + state: present update_cache: yes when: ansible_pkg_mgr == "yum" and ansible_os_family == "RedHat" notify: diff --git a/tasks/extensions/extra_packages.yml b/tasks/extensions/extra_packages.yml new file mode 100644 index 000000000..6973136bd --- /dev/null +++ b/tasks/extensions/extra_packages.yml @@ -0,0 +1,55 @@ +# file: postgresql/tasks/extensions/extra_packages.yml + +- include_vars: "../../vars/extra_packages.yml" + +# keys +- name: PostgreSQL | Extensions | Add repo keys | apt + apt_key: + id: "{{ item.value.id }}" + url: "{{ item.value.url }}" + state: present + keyring: /etc/apt/trusted.gpg.d/{{ item.value.id }}.gpg + loop: "{{ postgresql_ext_extra_packages.apt_keys | default({}) | dict2items }}" + when: + - postgresql_ext_extra_packages is defined + - ansible_os_family == "Debian" + +# repositories +- name: PostgreSQL | Extensions | Add repos | apt + apt_repository: + repo: "{{ item.value }}" + state: present + loop: "{{ postgresql_ext_extra_packages.apt_repositories | default({}) | dict2items }}" + when: + - postgresql_ext_extra_packages is defined + - ansible_os_family == "Debian" +- name: PostgreSQL | Extensions | Add repos | RHEL + yum_repository: + name: "{{ item.value.name }}" + description: "{{ item.value.description }}" + baseurl: "{{ item.value.url }}" + gpgkey: "{{ item.value.gpgkey }}" + enabled: yes + loop: "{{ postgresql_ext_extra_packages.yum_repositories | default({}) | dict2items }}" + when: + - postgresql_ext_extra_packages is defined + - ansible_os_family == "RedHat" + +# packages +- name: PostgreSQL | Extensions | Add packages | apt + apt: + name: "{{ postgresql_ext_extra_packages.names }}" + state: present + update_cache: yes + cache_valid_time: "{{ apt_cache_valid_time | default (3600) }}" + when: + - postgresql_ext_extra_packages is defined + - ansible_os_family == "Debian" +- name: PostgreSQL | Extensions | Add packages | RHEL + yum: + name: "{{ postgresql_ext_extra_packages.names }}" + state: present + update_cache: yes + when: + - postgresql_ext_extra_packages is defined + - ansible_os_family == "RedHat" diff --git a/tasks/install_rhel.yml b/tasks/install_rhel.yml index f8a755bf4..40860ed2e 100644 --- a/tasks/install_rhel.yml +++ b/tasks/install_rhel.yml @@ -22,7 +22,7 @@ - name: PostgreSQL | Disable postgresql module (necessary for RHEL8+) command: cmd: dnf module disable postgresql -y - when: "ansible_distribution_major_version == '8'" + when: "ansible_distribution_major_version == '8' or ansible_distribution_major_version == '9'" register: disable_postgresql_module changed_when: - "disable_postgresql_module.rc == 0" diff --git a/tasks/main.yml b/tasks/main.yml index 9eedb0616..d932f3acb 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -21,7 +21,7 @@ tags: [postgresql, postgresql-install] - import_tasks: install_rhel.yml - when: (ansible_pkg_mgr == "yum" or ansible_pkg_mgr == "dnf") and (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "OracleLinux") + when: (ansible_pkg_mgr == "yum" or ansible_pkg_mgr == "dnf") and (ansible_distribution == "RedHat" or ansible_distribution == "CentOS" or ansible_distribution == "OracleLinux" or ansible_distribution == "Rocky") tags: [postgresql, postgresql-install] - import_tasks: install_fedora.yml diff --git a/tasks/schemas.yml b/tasks/schemas.yml index 6842e6541..7de47ba61 100644 --- a/tasks/schemas.yml +++ b/tasks/schemas.yml @@ -12,5 +12,6 @@ state: "{{ item.state | default('present') }}" become: yes become_user: "{{ postgresql_admin_user }}" + no_log: "{{ postgresql_hide_passwords }}" with_items: "{{ postgresql_database_schemas }}" when: postgresql_databases|length > 0 diff --git a/tasks/users.yml b/tasks/users.yml index dafe16cb6..cca86fd60 100644 --- a/tasks/users.yml +++ b/tasks/users.yml @@ -13,7 +13,7 @@ port: "{{postgresql_port}}" state: "{{ item.state | default('present') }}" login_user: "{{postgresql_admin_user}}" - no_log: true + no_log: "{{ postgresql_hide_passwords }}" become: yes become_user: "{{postgresql_admin_user}}" with_items: "{{postgresql_users}}" diff --git a/templates/postgresql.conf-14.j2 b/templates/postgresql.conf-14.j2 index a7512ef06..511d34093 100644 --- a/templates/postgresql.conf-14.j2 +++ b/templates/postgresql.conf-14.j2 @@ -731,8 +731,11 @@ jit_provider = '{{ postgresql_jit_provider }}' # JIT library to use # - Other Defaults - dynamic_library_path = '{{ postgresql_dynamic_library_path }}' +{% if postgresql_extension_destdir is defined and ansible_os_family == 'Debian' %} extension_destdir = '{{ postgresql_extension_destdir }}' # prepend path when loading extensions # and shared objects (added by Debian) +{% endif %} + gin_fuzzy_search_limit = {{ postgresql_gin_fuzzy_search_limit }} diff --git a/templates/postgresql.conf-15.j2 b/templates/postgresql.conf-15.j2 index 2cae19e0a..7f4d61bc8 100644 --- a/templates/postgresql.conf-15.j2 +++ b/templates/postgresql.conf-15.j2 @@ -746,7 +746,7 @@ jit_provider = '{{ postgresql_jit_provider }}' # JIT library to use # - Other Defaults - dynamic_library_path = '{{ postgresql_dynamic_library_path }}' -{% if postgresql_extension_destdir is defined %} +{% if postgresql_extension_destdir is defined and ansible_os_family == 'Debian' %} extension_destdir = '{{ postgresql_extension_destdir }}' # prepend path when loading extensions # and shared objects (added by Debian) {% endif %} diff --git a/tests/playbook.yml b/tests/playbook.yml index 01e19d292..07ad2478a 100644 --- a/tests/playbook.yml +++ b/tests/playbook.yml @@ -7,4 +7,3 @@ - ./vars.{{ ansible_distribution }}.{{ ansible_distribution_major_version }}.yml roles: - postgresql - diff --git a/tests/prepare.yml b/tests/prepare.yml index 48e7cf9bf..65a564e83 100644 --- a/tests/prepare.yml +++ b/tests/prepare.yml @@ -72,4 +72,4 @@ retries: 30 delay: 5 when: (ansible_distribution == 'Fedora') - changed_when: false \ No newline at end of file + changed_when: false diff --git a/tests/vars.CentOS.7.yml b/tests/vars.CentOS.7.yml index fb25db6b0..9cbf06919 100644 --- a/tests/vars.CentOS.7.yml +++ b/tests/vars.CentOS.7.yml @@ -1,3 +1,3 @@ --- #--- picking the correct python interpreter -ansible_python_interpreter: "/usr/bin/python" \ No newline at end of file +ansible_python_interpreter: "/usr/bin/python" diff --git a/tests/vars.CentOS.8.yml b/tests/vars.CentOS.8.yml index ab00d6d9b..ccf006385 100644 --- a/tests/vars.CentOS.8.yml +++ b/tests/vars.CentOS.8.yml @@ -1,3 +1,3 @@ --- #--- picking the correct python interpreter -ansible_python_interpreter: "/usr/bin/python3" \ No newline at end of file +ansible_python_interpreter: "/usr/bin/python3" diff --git a/tests/vars.Debian.10.yml b/tests/vars.Debian.10.yml index ab00d6d9b..ccf006385 100644 --- a/tests/vars.Debian.10.yml +++ b/tests/vars.Debian.10.yml @@ -1,3 +1,3 @@ --- #--- picking the correct python interpreter -ansible_python_interpreter: "/usr/bin/python3" \ No newline at end of file +ansible_python_interpreter: "/usr/bin/python3" diff --git a/tests/vars.Debian.12.yml b/tests/vars.Debian.12.yml new file mode 100644 index 000000000..ccf006385 --- /dev/null +++ b/tests/vars.Debian.12.yml @@ -0,0 +1,3 @@ +--- +#--- picking the correct python interpreter +ansible_python_interpreter: "/usr/bin/python3" diff --git a/tests/vars.Debian.9.yml b/tests/vars.Debian.9.yml index fb25db6b0..9cbf06919 100644 --- a/tests/vars.Debian.9.yml +++ b/tests/vars.Debian.9.yml @@ -1,3 +1,3 @@ --- #--- picking the correct python interpreter -ansible_python_interpreter: "/usr/bin/python" \ No newline at end of file +ansible_python_interpreter: "/usr/bin/python" diff --git a/tests/vars.Debian.yml b/tests/vars.Debian.yml index fb25db6b0..9cbf06919 100644 --- a/tests/vars.Debian.yml +++ b/tests/vars.Debian.yml @@ -1,3 +1,3 @@ --- #--- picking the correct python interpreter -ansible_python_interpreter: "/usr/bin/python" \ No newline at end of file +ansible_python_interpreter: "/usr/bin/python" diff --git a/tests/vars.Fedora.37.yml b/tests/vars.Fedora.37.yml index ab00d6d9b..ccf006385 100644 --- a/tests/vars.Fedora.37.yml +++ b/tests/vars.Fedora.37.yml @@ -1,3 +1,3 @@ --- #--- picking the correct python interpreter -ansible_python_interpreter: "/usr/bin/python3" \ No newline at end of file +ansible_python_interpreter: "/usr/bin/python3" diff --git a/tests/vars.Ubuntu.18.yml b/tests/vars.Ubuntu.18.yml index ab00d6d9b..ccf006385 100644 --- a/tests/vars.Ubuntu.18.yml +++ b/tests/vars.Ubuntu.18.yml @@ -1,3 +1,3 @@ --- #--- picking the correct python interpreter -ansible_python_interpreter: "/usr/bin/python3" \ No newline at end of file +ansible_python_interpreter: "/usr/bin/python3" diff --git a/tests/vars.Ubuntu.20.yml b/tests/vars.Ubuntu.20.yml index ab00d6d9b..ccf006385 100644 --- a/tests/vars.Ubuntu.20.yml +++ b/tests/vars.Ubuntu.20.yml @@ -1,3 +1,3 @@ --- #--- picking the correct python interpreter -ansible_python_interpreter: "/usr/bin/python3" \ No newline at end of file +ansible_python_interpreter: "/usr/bin/python3" diff --git a/vagrant-inventory b/vagrant-inventory index fba7c6622..db90952aa 100644 --- a/vagrant-inventory +++ b/vagrant-inventory @@ -1,6 +1,2 @@ [anxs] -## DISABLED ## ubuntu16.local ansible_ssh_host=192.168.88.10 ansible_ssh_port=22 ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key -jessie64.local ansible_ssh_host=192.168.88.20 ansible_ssh_port=22 ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key -wheezy64.local ansible_ssh_host=192.168.88.21 ansible_ssh_port=22 ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key -centos7.local ansible_ssh_host=192.168.88.31 ansible_ssh_port=22 ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key -## DISABLED ## fedora27.local ansible_ssh_host=192.168.88.40 ansible_ssh_port=22 ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key +jammy64.local ansible_ssh_host=192.168.88.22 ansible_ssh_port=22 ansible_ssh_user=vagrant ansible_ssh_private_key_file=~/.vagrant.d/insecure_private_key diff --git a/vars/Debian_22.yml b/vars/Debian_22.yml index 6bd6082af..72871d6c3 100644 --- a/vars/Debian_22.yml +++ b/vars/Debian_22.yml @@ -1,4 +1,3 @@ --- # PostgreSQL vars for Debian based distributions - -postgresql_apt_repository: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main {{ postgresql_version }}" \ No newline at end of file +postgresql_apt_repository: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt/ {{ ansible_distribution_release }}-pgdg main {{ postgresql_version }}" diff --git a/vars/RedHat_8.yml b/vars/RedHat_8.yml index 49f177a29..7e962d984 100644 --- a/vars/RedHat_8.yml +++ b/vars/RedHat_8.yml @@ -25,3 +25,5 @@ postgresql_packages: - glibc-common - epel-release - python3-libselinux + - glibc-locale-source + - glibc-langpack-en diff --git a/vars/RedHat_9.yml b/vars/RedHat_9.yml new file mode 100644 index 000000000..6555c04fb --- /dev/null +++ b/vars/RedHat_9.yml @@ -0,0 +1,29 @@ +--- +# PostgreSQL vars for RedHat 9+ based distributions +# +# Using a different cluster name could cause problems with SELinux. +# See /usr/lib/systemd/system/postgresql-*.service +postgresql_cluster_name: "data" +postgresql_service_name: "postgresql-{{ postgresql_version }}" + +postgresql_varlib_directory_name: "pgsql" + +# Used to execute initdb +postgresql_bin_directory: "/usr/pgsql-{{postgresql_version}}/bin" + +postgresql_unix_socket_directories: + - "{{ postgresql_pid_directory }}" + - /tmp + +postgresql_fdw_mysql_packages: "mysql_fdw_{{ postgresql_version_terse }}" +postgresql_fdw_ogr_packages: "ogr_fdw{{ postgresql_version_terse }}" + +postgresql_packages: + - ca-certificates + - python3-psycopg2 + - python3-pycurl + - glibc-common + - epel-release + - python3-libselinux + - glibc-locale-source + - glibc-langpack-en diff --git a/vars/extra_packages.yml b/vars/extra_packages.yml new file mode 100644 index 000000000..1feb5a132 --- /dev/null +++ b/vars/extra_packages.yml @@ -0,0 +1,18 @@ +--- +# This file defines (optional) repos and packages - uncomment necessary lines + +# postgresql_ext_extra_packages: +# names: +# - pgadmin4-server +# apt_repositories: +# depot-pgadmin: "deb [signed-by=/etc/apt/trusted.gpg.d/8881B2A8210976F2.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/jammy pgadmin4 main" +# apt_keys: +# depot-pgadmin: +# id: "8881B2A8210976F2" +# url: "https://www.pgadmin.org/static/packages_pgadmin_org.pub" +# yum_repositories: +# depot-pgadmin: +# name: pgadmin +# description: the most popular and feature rich Open Source administration and development platform for PostgreSQL +# url: "https://ftp.postgresql.org/pub/pgadmin/pgadmin4/yum/redhat/rhel-9-x86_64" +# gpgkey: "https://www.pgadmin.org/static/packages_pgadmin_org.pub" diff --git a/version b/version index 471578389..440ddd8f1 100644 --- a/version +++ b/version @@ -1 +1 @@ -v1.14.2 +v1.15.0