[ANSIBLE] Ad-Hoc

커맨드 명령으로 원격지 /etc/ansible/hosts 에 정의된 서버노드들에 대해 명령을 보낸다.


EXAMPLE

1
ansible webservers -a "ls -al"

파일전송

1
$ ansible webservers -m file -a "dest=/path/to/c mode=755 owner=mdehaan group=mdehaan state=directory"

yum 설치

1
$ ansible webservers -m yum -a "name=acme state=absent"

GIT 명령

1
$ ansible webservers -m git -a "repo=https://foo.example.org/repo.git dest=/srv/myapp version=HEAD"

서비스 관리

1
$ ansible webservers -m service -a "name=httpd state=restarted"