# Install SDP # ------------------------------------------------------------------ - name: Rotate master journals hosts: commit tasks: - name: Rotate journals on master to contain replica info shell: /p4/common/bin/daily_checkpoint.sh 1 # ------------------------------------------------------------------ - name: Install SDP hosts: replicas # user: perforce tasks: - name: Set ownership of /hx* to perforce user file: path: /hxdepots/sdp owner: "perforce" recurse: true with_items: - /hxdepots - /hxmetadata1 - /hxmetadata2 - /hxlogs become: yes - name: copy SDP from master to replica synchronize: src: /hxdepots/sdp dest: /hxdepots/ # ------------------------------------------------------------------ - name: Install SDP HA replica hosts: replica_ha vars: server_type: p4d_ha server_id: p4d_ha_bos tasks: - name: Update variables in config file lineinfile: dest: /hxdepots/sdp/Server/Unix/setup/mkdirs.cfg regexp: "{{item.regexp}}" line: "{{item.line}}" with_items: - {regexp: '^SSL_PREFIX=', line: 'SSL_PREFIX='} - {regexp: '^P4DNSNAME=', line: 'P4DNSNAME=master'} - {regexp: '^SERVER_TYPE=', line: 'SERVER_TYPE={{server_type}}'} - {regexp: '^REPLICA_ID=', line: 'REPLICA_ID={{server_id}}'} - name: Execute replica mkdirs (as root) shell: cd /hxdepots/sdp/Server/Unix/setup && ./mkdirs.sh 1 become: yes - name: copy checkpoints to replica synchronize: src: /p4/1/checkpoints/ dest: /p4/1/checkpoints/ - name: copy mkrep logs to replica synchronize: src: /p4/1/logs/ dest: /p4/1/logs/ - name: Record name of mkrep log for this server shell: grep "p4 server {{server_id}}" /p4/1/logs/mkrep* | tail -1 | sed -e 's/:.*//' register: mkrep_log - name: Get local service user command which contains random generated password shell: grep -A1 "Create local service user password file" {{mkrep_log.stdout_lines[0]}} | tail -1 register: pwd_cmd - name: STEP 5.1 Create local service user password file - execute command shell: "{{pwd_cmd.stdout_lines[0]}}" - name: Record latest checkpoint file shell: ls -tr /p4/1/checkpoints/*.ckp.*.gz | tail -1 register: ckp_file - name: STEP 7 Create server id shell: "echo {{server_id}} > /p4/1/root/server.id" - name: STEP 7.1 Create offline server id shell: "echo {{server_id}} > /p4/1/offline_db/server.id" - name: STEP 9 Create db files shell: "/p4/1/bin/p4d_1 -r /p4/1/root -z -jr {{ ckp_file.stdout_lines[0] }}" - name: STEP 9.1 Create offline_db files shell: "/p4/1/bin/p4d_1 -r /p4/1/offline_db -z -jr {{ ckp_file.stdout_lines[0] }}" - name: STEP 9.2 Mark the Offline_db as usable shell: "echo Usable > /p4/1/offline_db/offline_db_usable.txt" - name: STEP 10.1 Login the service user to the master shell: "P4TICKETS=/p4/1/.p4tickets /p4/1/bin/p4_1 -u svc_{{server_id}} -p master:1667 login < /p4/common/config/.p4passwd.p4_1.service" - name: STEP 10. Start the replica shell: "/p4/1/bin/p4d_1_init start" # ------------------------------------------------------------------ - name: Install SDP forwarding replica hosts: replica_fr vars: server_type: p4d_fr server_id: p4d_fr_bos tasks: - name: Update variables in config file lineinfile: dest: /hxdepots/sdp/Server/Unix/setup/mkdirs.cfg regexp: "{{item.regexp}}" line: "{{item.line}}" with_items: - {regexp: '^SSL_PREFIX=', line: 'SSL_PREFIX='} - {regexp: '^P4DNSNAME=', line: 'P4DNSNAME=master'} - {regexp: '^SERVER_TYPE=', line: 'SERVER_TYPE={{server_type}}'} - {regexp: '^REPLICA_ID=', line: 'REPLICA_ID={{server_id}}'} - name: Execute replica mkdirs (as root) shell: cd /hxdepots/sdp/Server/Unix/setup && ./mkdirs.sh 1 become: yes - name: copy checkpoints to replica synchronize: src: /p4/1/checkpoints/ dest: /p4/1/checkpoints/ - name: copy mkrep logs to replica synchronize: src: /p4/1/logs/ dest: /p4/1/logs/ - name: Record name of mkrep log for this server shell: grep "p4 server {{server_id}}" /p4/1/logs/mkrep* | tail -1 | sed -e 's/:.*//' register: mkrep_log - name: Get local service user command which contains random generated password shell: grep -A1 "Create local service user password file" {{mkrep_log.stdout_lines[0]}} | tail -1 register: pwd_cmd - name: STEP 5.1 Create local service user password file - execute command shell: "{{pwd_cmd.stdout_lines[0]}}" - name: Record latest checkpoint file shell: ls -tr /p4/1/checkpoints/*.ckp.*.gz | tail -1 register: ckp_file - name: STEP 7 Create server id shell: "echo {{server_id}} > /p4/1/root/server.id" - name: STEP 7.1 Create offline server id shell: "echo {{server_id}} > /p4/1/offline_db/server.id" - name: STEP 9 Create db files shell: "/p4/1/bin/p4d_1 -r /p4/1/root -z -jr {{ ckp_file.stdout_lines[0] }}" - name: STEP 9.1 Create offline_db files shell: "/p4/1/bin/p4d_1 -r /p4/1/offline_db -z -jr {{ ckp_file.stdout_lines[0] }}" - name: STEP 9.2 Mark the Offline_db as usable shell: "echo Usable > /p4/1/offline_db/offline_db_usable.txt" - name: STEP 10.1 Login the service user to the master shell: "P4TICKETS=/p4/1/.p4tickets /p4/1/bin/p4_1 -u svc_{{server_id}} -p master:1667 login < /p4/common/config/.p4passwd.p4_1.service" - name: STEP 10. Start the replica shell: "/p4/1/bin/p4d_1_init start" # ------------------------------------------------------------------ - name: Install SDP edge server hosts: replica_edge vars: server_type: p4d_edge server_id: p4d_edge_bos tasks: - name: Update variables in config file lineinfile: dest: /hxdepots/sdp/Server/Unix/setup/mkdirs.cfg regexp: "{{item.regexp}}" line: "{{item.line}}" with_items: - {regexp: '^SSL_PREFIX=', line: 'SSL_PREFIX='} - {regexp: '^P4DNSNAME=', line: 'P4DNSNAME=master'} - {regexp: '^SERVER_TYPE=', line: 'SERVER_TYPE={{server_type}}'} - {regexp: '^REPLICA_ID=', line: 'REPLICA_ID={{server_id}}'} - name: Execute replica mkdirs (as root) shell: cd /hxdepots/sdp/Server/Unix/setup && ./mkdirs.sh 1 become: yes - name: copy checkpoints to replica synchronize: src: /p4/1/checkpoints/ dest: /p4/1/checkpoints/ - name: copy mkrep logs to replica synchronize: src: /p4/1/logs/ dest: /p4/1/logs/ - name: Record name of mkrep log for this server shell: grep "p4 server {{server_id}}" /p4/1/logs/mkrep* | tail -1 | sed -e 's/:.*//' register: mkrep_log - name: Get local service user command which contains random generated password shell: grep -A1 "Create local service user password file" {{mkrep_log.stdout_lines[0]}} | tail -1 register: pwd_cmd - name: STEP 5.1 Create local service user password file - execute command shell: "{{pwd_cmd.stdout_lines[0]}}" - name: Record latest checkpoint file shell: ls -tr /p4/1/checkpoints/*.ckp.*.gz | tail -1 register: ckp_file - name: STEP 7 Create server id shell: "echo {{server_id}} > /p4/1/root/server.id" - name: STEP 7.1 Create offline server id shell: "echo {{server_id}} > /p4/1/offline_db/server.id" - name: STEP 9 Create db files shell: "/p4/1/bin/p4d_1 -r /p4/1/root -z -jr {{ ckp_file.stdout_lines[0] }}" - name: STEP 9.1 Create offline_db files shell: "/p4/1/bin/p4d_1 -r /p4/1/offline_db -z -jr {{ ckp_file.stdout_lines[0] }}" - name: STEP 9.2 Mark the Offline_db as usable shell: "echo Usable > /p4/1/offline_db/offline_db_usable.txt" - name: STEP 10.1 Login the service user to the master shell: "P4TICKETS=/p4/1/.p4tickets /p4/1/bin/p4_1 -u svc_{{server_id}} -p master:1667 login < /p4/common/config/.p4passwd.p4_1.service" - name: STEP 10. Start the replica shell: "/p4/1/bin/p4d_1_init start"