2015-02-03 2 views
0

У меня есть этот сборник пьес:Newbee пытается использовать анзибль и странная ошибка

- name: main playbook 
    hosts: 127.0.0.1 
    connection: local 
    sudo: Yes 
    gather_facts: True 
    vars_files: 
- /home/core/REPO/alonso/core2door-integration/workflows/core2door.ansible/vars-feed.yml 
    tasks: 
- include: tasks/feed-adapter.yml 

tasks/feed-adapter.yml 

# This playbook deploys feed-adapter application in this host. This app needs a jar that basically writes to HDFS and write a log in a system, 
# actually Impala. Variables are described within vars-feed.yml file. 
- name: feed-adapter playbook 
    hosts: "{{host_feed}}" 
    remote_user: "{{remote-user}}" 
    sudo: Yes 

- name: Creates feed_adapter_outputpath directory 
    file: path=/var/app/feed-adapter/ state=directory 

- name: Creates check-feed-adapter-folders_outputpath directory 
    file: path=/var/app/check-feed-adapter-folders/ state=directory 

- name: Copy supervisor conf files to /etc/supervisor.d folder 
    copy: src=/home/core/REPO/alonso/core2door-integration/feed-adapter/feed_adapter_Sip_Pub.conf dest=/etc/supervisor.d/feed_adapter_Sip_Pub.conf owner=root group=root mode=0644 

- name: Copy generated jar to destination folder 
    copy: src=/home/core/REPO/alonso/core2door-integration/feed-adapter/target/feed-adapter-0.0.1-SNAPSHOT.jar dest=/var/app/check-feed-adapter-folders/feed-adapter.jar mode=0644 

- name: Copy necessary .properties files to destination folder 
    copy: src=/home/core/REPO/alonso/core2door-integration/feed-adapter/feed-adapter-SIP-Pub.properties dest=/var/app/check-feed-adapter-folders/feed-adapter-SIP-Pub.properties mode=0644 

- name: Copy check-feed-adapter-folders jar to destination folder 
    copy: src=/home/core/REPO/alonso/core2door-integration/CheckFeedAdapterFolders/target/CheckFeedAdapterFolders-0.0.1-SNAPSHOT.jar dest=/var/app/check-feed-adapter-folders/CheckFeedAdapterFolders.jar mode=0644 

- name: Copy check.sh script to destination folder 
    copy: src=/home/core/REPO/alonso/core2door-integration/CheckFeedAdapterFolders/check.sh dest=/var/app/check-feed-adapter-folders/check.sh mode=0644 

и когда я пытаюсь запустить сборник пьес, он возвращает мне этот выход:

$ ansible-playbook playbook.yml --syntax-check --i hosts.txt 
/usr/lib/python2.6/site-packages/setuptools-12.0.5-py2.6.egg/pkg_resources/__init__.py:1222: UserWarning: 
/home/core/.python-eggs is writable by group/others and vulnerable to 
attack when used with get_resource_filename. Consider a more secure 
location (set with .set_extraction_path or the PYTHON_EGG_CACHE 
environment variable). 

playbook: playbook.yml 

ERROR: copy is not a legal parameter at this level in an Ansible Playbook 

Пожалуйста, помогите, Я новичок с правдой.

UPDATE

после консультации Даниила, я тщательно отступом пьес, и я получаю эту ошибку:

$ vi tasks/feed-adapter.yml 
$ ansible-playbook playbook.yml --syntax-check --i hosts.txt 
/usr/lib/python2.6/site-packages/setuptools-12.0.5-py2.6.egg/pkg_resources/__init__.py:1222: UserWarning: 
/home/core/.python-eggs is writable by group/others and vulnerable to 
attack when used with get_resource_filename. Consider a more secure 
location (set with .set_extraction_path or the PYTHON_EGG_CACHE 
environment variable). 

playbook: playbook.yml 

ERROR: file is not a legal parameter at this level in an Ansible Playbook 

UPDATE 2:

Выполнение анзибль-пьес с -vvvv шоу тот же выход:

ERROR: file is not a legal parameter at this level in an Ansible Playbook 
[[email protected] core2door.ansible]$ ansible-playbook --i hosts.txt -vvvv playbook.yml 
/usr/lib/python2.6/site-packages/setuptools-12.0.5-py2.6.egg/pkg_resources/__init__.py:1222: UserWarning: /home/core/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable). 
ERROR: file is not a legal parameter at this level in an Ansible Playbook 

Я предполагаю, что ошибка пришла wi й строке:

- name: Creates feed_adapter_outputpath directory 
    file: path=/var/app/feed-adapter/ state=directory 
+1

всегда использовать '-vvvv' на рисунке что не так с данной Ansible play. Добавьте сюда этот вывод. – tedder42

+1

Вы пытались исправить ошибку «writeable by group/others»? Что происходит тогда? Кроме того, сообщение 'ERROR:' по-прежнему показывает, что у вас есть отступы неправильно. Ваша пьеса _exactly_ так, как она показана выше? в пространствах ЯМЛ. – Mxx

ответ

1

Вы должны быть очень осторожны с отступом строки при работе с файлами yaml. Ошибка здесь, вероятно, вызвано copy элемента в строке 28:

- name: ... 
    copy: ... 

Добавить два пробела перед copy, так это выглядит следующим образом:

- name: ... 
    copy: ... 
Смежные вопросы