Ошибка при запуске ANSIBLE PlayBook с ролями - PullRequest
0 голосов
/ 11 июля 2019

пытается сделать playbook:

- hosts: win
  gather_facts: no
  roles: 
    - update_win

update_win mail.yml:

- name: Create Auto_deploy_temp folder on remoter host
  win_file:
    path: {{ disk }}\Auto_deploy_temp
    state: directory

и переменные в файле групповых переменных win.yml:

disk: 'c:'

но выходит:

ERROR! Syntax Error while loading YAML.
  did not find expected key

The error appears to be in '/etc/ansible/roles/update_win/tasks/main.yml': line 3, column 19, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  win_file:
  path: {{ disk }}\Auto_deploy_temp
                  ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - "{{ foo }}"

can u help me with this issue?

P.S .: ранее я запустил некоторый подобный код, но в начале выражения пути не было переменных, только в конце

Ответы [ 2 ]

0 голосов
/ 11 июля 2019

Побег '\'

win_file:
path: {{ disk }}\\Auto_deploy_temp
0 голосов
/ 11 июля 2019

Укажите путь: "{{disk}} \ Auto_deploy_temp"

Обновление
Создайте новый var как path_dir: \ Auto_deploy_temp и используйте
путь: "{{disk}} {{path_dir}} "
или
path:" {{disk}} \\ Auto_deploy_temp "

...