File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,18 @@ def postgres_role
2828 nil
2929 end
3030
31+ def convert_to_master
32+ commands = [
33+ 'touch /tmp/postgresql.trigger' ,
34+ 'sed -i "/^primary_conninfo/d; /^promote_trigger_file/d" /var/lib/pgsql/data/postgresql.conf'
35+ ]
36+
37+ commands . each do |cmd |
38+ full_cmd = "rbcli node execute all -- '#{ cmd } '"
39+ system ( full_cmd )
40+ end
41+ end
42+
3143 def update_hosts_for_master ( new_master_ip )
3244 hosts_file = '/etc/hosts'
3345 service_name = 'master.postgresql.service'
@@ -38,7 +50,7 @@ def update_hosts_for_master(new_master_ip)
3850 hosts_content << "#{ new_entry } \n "
3951 ::File . open ( hosts_file , 'w' ) { |file | file . puts hosts_content }
4052 rescue => e
41- Chef ::Log . error ( "Error actualizando /etc/hosts: #{ e . message } " )
53+ Chef ::Log . error ( "Error updating /etc/hosts: #{ e . message } " )
4254 end
4355 end
4456
Original file line number Diff line number Diff line change 88attribute :postgresql_port , kind_of : Integer , default : 5432
99attribute :cdomain , kind_of : String , default : 'redborder.cluster'
1010attribute :ipaddress , kind_of : String , default : '127.0.0.1'
11+ attribute :virtual_ips , kind_of : Hash , default : { }
You can’t perform that action at this time.
0 commit comments