From 700f7e6a693de2eca3e0613ed6f20154f88ae07a Mon Sep 17 00:00:00 2001 From: w00607094 Date: Tue, 20 May 2025 10:00:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?scp=E6=A8=A1=E5=9D=97=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ascend_deployer/library/scp.py | 5 ++++- ascend_deployer/playbooks/distribution.yml | 1 + .../playbooks/install/install_ascend-device-plugin.yml | 2 ++ .../playbooks/install/install_ascend-operator.yml | 2 ++ ascend_deployer/playbooks/install/install_clusterd.yml | 2 ++ .../playbooks/install/install_hccl-controller.yml | 2 ++ ascend_deployer/playbooks/install/install_noded.yml | 2 ++ ascend_deployer/playbooks/install/install_npu-exporter.yml | 2 ++ .../playbooks/install/install_resilience-controller.yml | 2 ++ ascend_deployer/playbooks/install/install_volcano.yml | 2 ++ ascend_deployer/playbooks/sync_time.yml | 1 + 11 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ascend_deployer/library/scp.py b/ascend_deployer/library/scp.py index c7a134ab..c8b4bd23 100644 --- a/ascend_deployer/library/scp.py +++ b/ascend_deployer/library/scp.py @@ -28,6 +28,7 @@ class Scp: self.module = AnsibleModule( argument_spec=dict( ip=dict(type="str", required=True), + port=dict(type="str", required=True), remote_user=dict(type="str", required=True), passwd=dict(type=str, required=True, no_log=True), src=dict(type="str", required=True), @@ -41,6 +42,7 @@ class Scp: self.src = self.module.params["src"] self.dest = self.module.params["dest"] self.fetch = self.module.params["fetch"] + self.port = self.module.params["port"] self.scp_src = self._parse_src() self.scp_dest = self._parse_dest() if self.fetch and not os.path.exists(self.scp_dest): @@ -51,8 +53,9 @@ class Scp: cmd_list = [] for src in self.scp_src: scp_base_cmd = ( + "-P {} " "-o GSSAPIAuthentication=no -o ControlMaster=auto -o ControlPersist=3600s -o StrictHostKeyChecking=no " - "-o User={} -o ConnectTimeout=10 {} {}".format(self.remote_user, src, self.scp_dest) + "-o User={} -o ConnectTimeout=10 {} {}".format(self.port, self.remote_user, src, self.scp_dest) ) scp_cmd = "scp -r {}".format(scp_base_cmd) if os.environ["SSHPASS"]: diff --git a/ascend_deployer/playbooks/distribution.yml b/ascend_deployer/playbooks/distribution.yml index 2d808533..f8bf2a9c 100644 --- a/ascend_deployer/playbooks/distribution.yml +++ b/ascend_deployer/playbooks/distribution.yml @@ -4,6 +4,7 @@ - name: scp to remote hosts scp: ip: "{{inventory_hostname}}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ansible_ssh_user}}" passwd: "{{ansible_ssh_pass|default('')}}" src: "~/resources_{{ansible_architecture}}.tar ../resources/{{os_and_arch}}/bzip2* ../resources/{{os_and_arch}}/unzip* ../resources/{{os_and_arch}}/tar*" diff --git a/ascend_deployer/playbooks/install/install_ascend-device-plugin.yml b/ascend_deployer/playbooks/install/install_ascend-device-plugin.yml index fe7e9f4e..c7a12e50 100644 --- a/ascend_deployer/playbooks/install/install_ascend-device-plugin.yml +++ b/ascend_deployer/playbooks/install/install_ascend-device-plugin.yml @@ -11,6 +11,7 @@ - name: fetch device-plugin image scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ device_plugin_images }}" @@ -34,6 +35,7 @@ - name: push images to remote scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ resource_path }}/mindxdl/dlImages/{{ ansible_architecture }}/device-plugin/*" diff --git a/ascend_deployer/playbooks/install/install_ascend-operator.yml b/ascend_deployer/playbooks/install/install_ascend-operator.yml index 22e53f27..c8b8c29d 100644 --- a/ascend_deployer/playbooks/install/install_ascend-operator.yml +++ b/ascend_deployer/playbooks/install/install_ascend-operator.yml @@ -11,6 +11,7 @@ - name: fetch ascend-operator image scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ ascend_operator_images }}" @@ -25,6 +26,7 @@ - name: push images to remote scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ resource_path }}/mindxdl/dlImages/{{ ansible_architecture }}/ascend-operator/*" diff --git a/ascend_deployer/playbooks/install/install_clusterd.yml b/ascend_deployer/playbooks/install/install_clusterd.yml index 13467f18..393b0201 100644 --- a/ascend_deployer/playbooks/install/install_clusterd.yml +++ b/ascend_deployer/playbooks/install/install_clusterd.yml @@ -27,6 +27,7 @@ - name: fetch clusterd image scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ clusterd_images }}" @@ -42,6 +43,7 @@ - name: push images to remote scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ resource_path }}/mindxdl/dlImages/{{ ansible_architecture }}/clusterd/*" diff --git a/ascend_deployer/playbooks/install/install_hccl-controller.yml b/ascend_deployer/playbooks/install/install_hccl-controller.yml index 6336773e..5fc94933 100644 --- a/ascend_deployer/playbooks/install/install_hccl-controller.yml +++ b/ascend_deployer/playbooks/install/install_hccl-controller.yml @@ -17,6 +17,7 @@ - name: fetch hccl-controller image scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ hccl_controller_images }}" @@ -32,6 +33,7 @@ - name: push images to remote scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ resource_path }}/mindxdl/dlImages/{{ ansible_architecture }}/hccl-controller/*" diff --git a/ascend_deployer/playbooks/install/install_noded.yml b/ascend_deployer/playbooks/install/install_noded.yml index 9c6d840a..db1e3da9 100644 --- a/ascend_deployer/playbooks/install/install_noded.yml +++ b/ascend_deployer/playbooks/install/install_noded.yml @@ -11,6 +11,7 @@ - name: fetch noded image scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ noded_images }}" @@ -25,6 +26,7 @@ - name: push images to remote scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ resource_path }}/mindxdl/dlImages/{{ ansible_architecture }}/noded/*" diff --git a/ascend_deployer/playbooks/install/install_npu-exporter.yml b/ascend_deployer/playbooks/install/install_npu-exporter.yml index ef2bd004..9cb6d40b 100644 --- a/ascend_deployer/playbooks/install/install_npu-exporter.yml +++ b/ascend_deployer/playbooks/install/install_npu-exporter.yml @@ -11,6 +11,7 @@ - name: fetch npu-exporter image scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ npu_exporter_images }}" @@ -25,6 +26,7 @@ - name: push images to remote scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ resource_path }}/mindxdl/dlImages/{{ ansible_architecture }}/npu-exporter/*" diff --git a/ascend_deployer/playbooks/install/install_resilience-controller.yml b/ascend_deployer/playbooks/install/install_resilience-controller.yml index 5bde1a55..3a8c1d37 100644 --- a/ascend_deployer/playbooks/install/install_resilience-controller.yml +++ b/ascend_deployer/playbooks/install/install_resilience-controller.yml @@ -11,6 +11,7 @@ - name: fetch resilience-controller image scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ resilience_controller_images }}" @@ -25,6 +26,7 @@ - name: push images to remote scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ resource_path }}/mindxdl/dlImages/{{ ansible_architecture }}/resilience-controller/*" diff --git a/ascend_deployer/playbooks/install/install_volcano.yml b/ascend_deployer/playbooks/install/install_volcano.yml index af6bd40c..1df6226e 100644 --- a/ascend_deployer/playbooks/install/install_volcano.yml +++ b/ascend_deployer/playbooks/install/install_volcano.yml @@ -11,6 +11,7 @@ - name: fetch volcano image scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ volcano_images }}" @@ -26,6 +27,7 @@ - name: push images to remote scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "{{ resource_path }}/mindxdl/dlImages/{{ ansible_architecture }}/volcano/*" diff --git a/ascend_deployer/playbooks/sync_time.yml b/ascend_deployer/playbooks/sync_time.yml index 40d9e9e0..2e13fe5d 100644 --- a/ascend_deployer/playbooks/sync_time.yml +++ b/ascend_deployer/playbooks/sync_time.yml @@ -5,6 +5,7 @@ - name: set timezone to local timezone scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "/etc/localtime" -- Gitee From 51ce02cd75525b7ace2ffc8a86ff3513c9cbdd7b Mon Sep 17 00:00:00 2001 From: w00607094 Date: Thu, 22 May 2025 15:29:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?scp=E6=A8=A1=E5=9D=97=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ascend_deployer/playbooks/{label_node.yaml => label_node.yml} | 1 + 1 file changed, 1 insertion(+) rename ascend_deployer/playbooks/{label_node.yaml => label_node.yml} (98%) diff --git a/ascend_deployer/playbooks/label_node.yaml b/ascend_deployer/playbooks/label_node.yml similarity index 98% rename from ascend_deployer/playbooks/label_node.yaml rename to ascend_deployer/playbooks/label_node.yml index 953af855..937bc58a 100644 --- a/ascend_deployer/playbooks/label_node.yaml +++ b/ascend_deployer/playbooks/label_node.yml @@ -51,6 +51,7 @@ - name: copy label yaml scp: ip: "{{ inventory_hostname }}" + port: "{{ansible_ssh_port|default('22')}}" remote_user: "{{ ansible_ssh_user }}" passwd: "{{ ansible_ssh_pass|default('') }}" src: "/root/.ascend_deployer/dl_yaml/label/label_node.json" -- Gitee