Python Automation deployment fabric how to configure ssh, encountered some problems?

there is a problem with the configuration of fabric automated deployment! I hope you can take the time to answer! (" ")

this is the code python
-sharp!/usr/bin/env python
-sharp -*- coding: utf-8 -*-

-sharp fabfile.py
import os, re
from datetime import datetime

-sharp Fabric API:
from fabric.api import *


env.use_ssh_config = True
-sharp :
-sharp env.user = "ubuntu"
-sharp sudoroot:
-sharp env.sudo_user = "ubuntu"
-sharp :
env.hosts = ["ubuntu@ec2-18-220-216-89.us-east-2.compute.amazonaws.com"]
-sharp env.key_filename = "/cygdrive/c/Users/jiaji/.ssh/jiajixuqqcom.pem"
-sharp env.ssh_config_path = "/cygdrive/c/Users/jiaji/.ssh/config"

-sharp MySQL:
db_user = "root"
db_password = "6Sb8qzM38"

_TAR_FILE = "dist-awesome.tar.gz"
_REMOTE_TMP_TAR = "/tmp/%s" % _TAR_FILE
_REMOTE_BASE_DIR = "/srv/awesome"


def touchfile():                         -sharp 
    run("touch /tmp/www.txt")
this is the config configuration of ssh
Host myserver
  HostName ec2-18-220-216-89.us-east-2.compute.amazonaws.com
  Port 22
  User ubuntu
  IdentityFile C:\Users\jiaji\.ssh\jiajixuqqcom.pem
ssh test can pass

clipboard.png

fab touchfile

clipboard.png

other information: amazon EC2 server, ssh private .pem is downloaded from the server background, but the ssh connection is successful. Cygwin64 Terminal is used to execute tab touchfile
Mar.14,2021

is really speechless, looking for problems all day. It suddenly occurred to me to use cmd to execute the fab command, and it turned out to be OK!

Menu