を持っていない、それがこのエラーで失敗します。ansibleはAttributeError:「リスト」オブジェクトは、私がansible実行していると、このタスクを動作させるためにしようとしています何の属性「STARTSWITH」
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'list' object has no attribute 'startswith' fatal: [test-1]: FAILED! => {"failed": true, "msg": "Unexpected failure during module execution.", "stdout": ""} msg: Unexpected failure during module execution.
コードは次のとおりです。
- name: Register env Type
shell: facter configured_setup
register: setup
- name: transparency tasks
shell: {{some_script}} -t -a {{hosts}} -i {{inventory_hostname}}
register: test
when: setup.stdout == "something"
- name: fetch group_vars
fetch:
src:
- { "{{ item }}", when: setup.stdout == "something" }
dest: "{{group_vars}}"
flat: yes
with_items:
- "{{ test.stdout_lines[0] }}"
- "{{ test.stdout_lines[1] }}"
"fetch group_vars"は常に失敗するタスクです。どのように動作するのでしょうか? 私がやろうとしているのは、異なるセバーサーからフェッチするためのソースファイルを追加することです。完全な誤りがある
を言って、:
An exception occurred during task execution. The full traceback is: Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 96, in run item_results = self._run_loop(items) File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 252, in _run_loop res = self._execute(variables=task_vars) File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 446, in _execute result = self._handler.run(task_vars=variables) File "/usr/lib/python2.7/site-packages/ansible/plugins/action/fetch.py", line 62, in run source = self._remote_expand_user(source) File "/usr/lib/python2.7/site-packages/ansible/plugins/action/init.py", line 460, in _remote_expand_user if not path.startswith('~'): # FIXME: Windows paths may start with "~ instead of just ~ AttributeError: 'list' object has no attribute 'startswith'
fatal: [test-1]: FAILED! => {"failed": true, "msg": "Unexpected failure during module execution.", "stdout": ""} msg: Unexpected failure during module execution.
あなたがしたように実験を開始するときは、インデントで一貫していることを確認してください。あなたのYAMLは、マッピングのために2つの位置を、そして要素の最初に測ったシーケンスのために4つの位置を使いますが、 'src 'の下に追加したシーケンスは3つの位置を使います。 YAMLはこれを分かち合うことができますが、一貫していないと自分で管理するのが非常に難しくなります。 – Anthon