ansible

ansible 정리

노마지 2016. 9. 29. 22:28

Ansible 정리

설치

brew install ansible or pip install ansible

설정

기본 ansible 인벤토리 파일은 hosts라는 파일 이름이며 /etc/ansible에 위치한다.

ansible all -m ping 으로 테스트 해볼 수 있다.

playbook

ansible은 playbook 도구를 이용함으로써 한 번에 수많은 장비에 수많은 액션을 수행할 수 있다. playbook은 yml 로 작성한다. (http://www.yaml.org/)

플레이북을 실행하는 커맨드는 ansible-playbook 이다.

---
- hosts: localhost
  user: root
  vars:
    motd_warning: 'TEST'
  tasks:
    - name: setup a MOTD
      copy: dests=/etc/motd content=({ motd_warning })