«   2021/01   »
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
01-22 18:44
Notice
Today
320
Total
1,397,712
관리 메뉴

변군이글루

[Fabric] fabric hello print on CentOS 7 본문

* 리눅스

[Fabric] fabric hello print on CentOS 7

변군 변군이글루 2021. 1. 11. 18:36

fabric hello print on CentOS 7

컨테이너 실행

$ docker run -d --rm --network host --privileged --name fabric --hostname fabric centos "/sbin/init"

컨테이너 안으로 진입

$ docker exec -it fabric bash

python3, pip3, fabric3 설치

[root@fabric /]$ yum install -y python3-devel python3-pip vim net-tools git

[root@fabric /]$ pip3 install fabric3

python3 및 fab 버전 확인

[root@fabric ~]$ python3 --version
Python 3.6.8

[root@fabric ~]$ fab -V
Fabric3 1.14.post1
Paramiko 2.7.2

fabfile.py 편집

[root@fabric fctl]$ vim fabfile.py
def hello():
    print("Hello world!")

def hello2(name="world"):
    print("Hello %s!" % name)

fab 실행

[root@fabric fctl]$ fab --list
Available commands:

    hello
    hello2
    
[root@fabric fctl]$ fab hello
Hello world!

Done.

[root@fabric fctl]$ fab hello2:name=sangchul
Hello sangchul!

Done.

 

 

0 Comments
댓글쓰기 폼