File tree Expand file tree Collapse file tree 8 files changed +25
-20
lines changed
server_install_os/controls Expand file tree Collapse file tree 8 files changed +25
-20
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ postgresql_access 'local_foo_user' do
6060 database ' all'
6161 user ' foo'
6262 address ' 127.0.0.1/32'
63- auth_method ' md5 '
63+ auth_method ' scram-sha-256 '
6464end
6565```
6666
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ def default_yum_gpg_key_uri
152152 if platform_family? ( 'rhel' ) && node [ 'platform_version' ] . to_i == 7
153153 'https://download.postgresql.org/pub/repos/yum/keys/PGDG-RPM-GPG-KEY-RHEL7'
154154 elsif platform_family? ( 'fedora' )
155- 'https://download.postgresql.org/pub/repos/yum/keys/PGDG-KEY-fedora '
155+ 'https://download.postgresql.org/pub/repos/yum/keys/PGDG-RPM-GPG- KEY-Fedora '
156156 else
157157 'https://download.postgresql.org/pub/repos/yum/keys/PGDG-RPM-GPG-KEY-RHEL'
158158 end
@@ -173,6 +173,10 @@ def rhel_init_db_command(new_resource)
173173 cmd << " -D '#{ data_dir } '"
174174 end
175175
176+ def fedora_init_db_command
177+ 'usr/bin/postgresql-setup --initdb'
178+ end
179+
176180 # Given the base URL build the complete URL string for a yum repo
177181 def yum_repo_url ( base_url )
178182 "#{ base_url } /#{ new_resource . version } /#{ yum_repo_platform_family_string } /#{ yum_repo_platform_string } "
Original file line number Diff line number Diff line change @@ -98,9 +98,10 @@ def install_method_repo?
9898 def do_repository_action ( repo_action )
9999 case node [ 'platform_family' ]
100100 when 'rhel' , 'fedora' , 'amazon'
101+ # Disable the PostgreSQL module if we're on RHEL 8 not on fedora
101102 dnf_module 'postgresql' do
102103 action :disable
103- end if dnf_module_platform?
104+ end if dnf_module_platform? && ! platform_family? ( 'fedora' )
104105
105106 remote_file '/etc/pki/rpm-gpg/PGDG-RPM-GPG-KEY' do
106107 source new_resource . yum_gpg_key_uri
@@ -272,7 +273,7 @@ def do_server_package_action(package_action)
272273
273274 converge_by ( 'Init PostgreSQL' ) do
274275 execute 'init_db' do
275- command rhel_init_db_command ( new_resource )
276+ command platform_family? ( 'fedora' ) ? fedora_init_db_command : rhel_init_db_command ( new_resource )
276277 user new_resource . initdb_user
277278 end
278279 end
Original file line number Diff line number Diff line change 99 database 'all'
1010 user 'postgres'
1111 address '127.0.0.1/32'
12- auth_method 'md5 '
12+ auth_method 'scram-sha-256 '
1313end
1414
1515postgresql_service 'postgresql' do
4545 type 'host'
4646 database 'all'
4747 user 'sous_chef'
48- auth_method 'md5 '
48+ auth_method 'scram-sha-256 '
4949 address '127.0.0.1/32'
5050 position 5
5151
7474 type 'host'
7575 database 'all'
7676 user 'hostname_user'
77- auth_method 'md5 '
77+ auth_method 'scram-sha-256 '
7878 address 'host.domain'
7979
8080 notifies :restart , 'postgresql_service[postgresql]' , :delayed
8484 type 'host'
8585 database 'all'
8686 user 'hostname.user'
87- auth_method 'md5 '
87+ auth_method 'scram-sha-256 '
8888 address 'host.domain'
8989
9090 notifies :restart , 'postgresql_service[postgresql]' , :delayed
9494 type 'host'
9595 database 'my_database'
9696 user 'hostname.user'
97- auth_method 'md5 '
97+ auth_method 'scram-sha-256 '
9898 address 'host.domain'
9999
100100 notifies :restart , 'postgresql_service[postgresql]' , :delayed
104104 type 'host'
105105 database 'my_database'
106106 user 'hostname.user'
107- auth_method 'md5 '
107+ auth_method 'scram-sha-256 '
108108 address 'a.very.long.host.domain.that.exceeds.the.max.of.24.characters'
109109
110110 notifies :restart , 'postgresql_service[postgresql]' , :delayed
135135 database 'foo,bar'
136136 user 'john,doe'
137137 address '127.0.0.1/32'
138- auth_method 'md5 '
138+ auth_method 'scram-sha-256 '
139139end
Original file line number Diff line number Diff line change 5050 database 'all'
5151 user 'postgres'
5252 address '127.0.0.1/32'
53- auth_method 'md5 '
53+ auth_method 'scram-sha-256 '
5454
5555 notifies :reload , 'postgresql_service[postgresql]' , :delayed
5656end
Original file line number Diff line number Diff line change 4141 database 'all'
4242 user 'postgres'
4343 address '127.0.0.1/32'
44- auth_method 'md5 '
44+ auth_method 'scram-sha-256 '
4545end
4646
4747postgresql_user 'postgres' do
7777 type 'host'
7878 database 'all'
7979 user 'sous_chef'
80- auth_method 'md5 '
80+ auth_method 'scram-sha-256 '
8181 address '127.0.0.1/32'
8282
8383 notifies :restart , 'postgresql_service[postgresql]' , :delayed
Original file line number Diff line number Diff line change 55 describe postgres_hba_conf . where { type == 'host' && user == 'postgres' } do
66 its ( 'database' ) { should cmp 'all' }
77 its ( 'user' ) { should cmp 'postgres' }
8- its ( 'auth_method' ) { should cmp 'md5 ' }
8+ its ( 'auth_method' ) { should cmp 'scram-sha-256 ' }
99 its ( 'address' ) { should cmp '127.0.0.1/32' }
1010 end
1111
2323 describe postgres_hba_conf . where { user == 'sous_chef' } do
2424 its ( 'database' ) { should cmp 'all' }
2525 its ( 'type' ) { should cmp 'host' }
26- its ( 'auth_method' ) { should cmp 'md5 ' }
26+ its ( 'auth_method' ) { should cmp 'scram-sha-256 ' }
2727 its ( 'address' ) { should cmp '127.0.0.1/32' }
2828 end
2929
4141 describe postgres_hba_conf . where { user == 'hostname_user' } do
4242 its ( 'database' ) { should cmp 'all' }
4343 its ( 'type' ) { should cmp 'host' }
44- its ( 'auth_method' ) { should cmp 'md5 ' }
44+ its ( 'auth_method' ) { should cmp 'scram-sha-256 ' }
4545 its ( 'address' ) { should cmp 'host.domain' }
4646 end
4747end
5353 describe postgres_hba_conf . where { address == 'a.very.long.host.domain.that.exceeds.the.max.of.24.characters' } do
5454 its ( 'database' ) { should cmp 'my_database' }
5555 its ( 'type' ) { should cmp 'host' }
56- its ( 'auth_method' ) { should cmp 'md5 ' }
56+ its ( 'auth_method' ) { should cmp 'scram-sha-256 ' }
5757 its ( 'address' ) { should cmp 'a.very.long.host.domain.that.exceeds.the.max.of.24.characters' }
5858 end
5959end
Original file line number Diff line number Diff line change 55 describe postgres_hba_conf . where { type == 'host' && user == 'postgres' } do
66 its ( 'database' ) { should cmp 'all' }
77 its ( 'user' ) { should cmp 'postgres' }
8- its ( 'auth_method' ) { should cmp 'md5 ' }
8+ its ( 'auth_method' ) { should cmp 'scram-sha-256 ' }
99 its ( 'address' ) { should cmp '127.0.0.1/32' }
1010 end
1111
2323 describe postgres_hba_conf . where { user == 'sous_chef' } do
2424 its ( 'database' ) { should cmp 'all' }
2525 its ( 'type' ) { should cmp 'host' }
26- its ( 'auth_method' ) { should cmp 'md5 ' }
26+ its ( 'auth_method' ) { should cmp 'scram-sha-256 ' }
2727 its ( 'address' ) { should cmp '127.0.0.1/32' }
2828 end
2929
You can’t perform that action at this time.
0 commit comments