ansible role file module error

ansible 테스트중에 지속적으로 file 모듈에서 에러가 발생했다.

SSH password:

ERROR! 'file' is not a valid attribute for a Play
The error appears to be in '/etc/ansible/roles/locale.yml': line 9, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
-
file:
^ here

---
become: true
become_user: root
hosts: all
name: rdate
tasks: ~
file:
group: users
mode: 493
owner: tomcatadm
path: /opt/oracle
state: present
name: "create a directory for apache tomcat"

yml 형식도 ok 그런데 file 모듈에서 에러가 발생한다.
그냥 권한 바꾸는 간단한 건데 여기에서 오랫동안 막혀있었다.

# ansible all -m file -a 'dest=/home/test state=file mode=755' -k

SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"gid": 1000,
"group": "centos",
"mode": "0755",
"owner": "centos",
"path": "/home/test",
"size": 0,
"state": "file",
"uid": 1000
}

file 모듈 문제일까 싶어서 ansible 명령어로 테스트 해보니 정상. 왜지?

그냥 배열 정리 잘해주니까 된다..

빡치네..

---
become: true
become_user: root
hosts: all
name: rdate
tasks:
- name: test
file:
mode: 766
path: /home/test
state: file

Share