반응형
MacOS에 Ansible을 설치하기
pip로 Ansible 설치
> pip3 install ansible
> ansible --version
ansible 2.10.9
config file = None
configured module search path = ['/Users/sangchul/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.9.1 (default, Jan 8 2021, 17:17:43) [Clang 12.0.0 (clang-1200.0.32.28)]
로컬호스트에 ansible 테스트
#ping 테스트
> ansible localhost -m ping
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | SUCCESS => {
"changed": false,
"ping": "pong"
}
#명령어(uname -a) 테스트
> ansible localhost -a 'uname -a'
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | CHANGED | rc=0 >>
Darwin hmac.local 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:47 PDT 2021; root:xnu-7195.101.2~1/RELEASE_X86_64 x86_64
inventory file(/etc/ansible/hosts) 구성
> sudo mkdir -p /etc/ansible
> sudo touch /etc/ansible/hosts
> sudo chmod 777 /etc/ansible/hosts
> vim /etc/ansible/hosts
[mac]
127.0.0.1
> ansible all --list-hosts
hosts (1):
127.0.0.1
728x90
반응형
'퍼블릭 클라우드' 카테고리의 다른 글
[Ansible] ansible 인벤토리 설정 파일 (0) | 2021.05.11 |
---|---|
[Ansible] ansible 인벤토리 설정 파일 (0) | 2021.05.07 |
[Terraform] 테라폼 인스턴스(private) 생성 (0) | 2021.04.30 |
[Terraform] 테라폼 인스턴스(public) 생성 (0) | 2021.04.30 |
[Terraform] 테라폼 리소스 태그 지정(tags) -2 (0) | 2021.04.27 |