- name: create apps directory
file:
path: "{{ apps_directory }}"
state: directory/touch/link
absent : 디렉토리를 recursive하게 삭제한다. 심볼링 링크도 삭제한다.
directory : 디렉토리가 존재하지 않는 경우 생성(recursively)
file : 파일 소유자, 그룹, 모드를 변경하는 등의 작업을 할 수 있다. 파일이 존재하지 않으면 생성되지 않는다.
hard : 하드 링크를 생성한다.
link : 심볼릭 링크를 생성한다.
touch : 리눅스 touch 명령어와 유사하다.
- name: 'create myfile.txt'
hosts: web1
tasks:
- name: 'create myfile.txt on web1'
file:
path: /root/myfile.txt
state: touch