Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The field 'loop' is supposed to be a string type... #193

Closed
snakelab opened this issue Sep 17, 2018 · 3 comments
Closed

The field 'loop' is supposed to be a string type... #193

snakelab opened this issue Sep 17, 2018 · 3 comments
Labels

Comments

@snakelab
Copy link

Hi folks,

i am getting this error on a was-instance:

TASK [dev-sec.os-hardening : include_tasks] *******************************************************************************************
fatal: [ec2-xx-xx-xx-115.eu-central-1.compute.amazonaws.com]: FAILED! => {"failed": true, "reason": "The field 'loop' is supposed to be a string type, however the incoming data structure is a <class 'ansible.parsing.yaml.objects.AnsibleSequence'>\n\nThe error appears to have been in '/home/user/playbooks/roles/dev-sec.os-hardening/tasks/minimize_access.yml': line 3, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n# Using a two-pass approach for checking directories in order to support symlinks.\n- include_tasks: find_files.yml\n  ^ here\n"}

This is the code-segment:

  1 ---
  2 # Using a two-pass approach for checking directories in order to support symlinks.
  3 - include_tasks: find_files.yml
  4   loop_control:
  5     loop_var: outer_item
  6   loop:
  7     - '/usr/local/sbin'
  8     - '/usr/local/bin'
  9     - '/usr/sbin'
 10     - '/usr/bin'
 11     - '/sbin'
 12     - '/bin'
 13     - '{{ os_env_extra_user_paths }}'

Any hint what is wrong here?

thanks.

Hartmut

@rndmh3ro
Copy link
Member

Hey Hartmut,

what Ansible version are you running? This errors seems to indicate you're still running 2.4.0. (see: ansible/ansible#38314)

@rndmh3ro
Copy link
Member

I'm closing this for now as I think, its a problem with the version. Feel free to reopen!

@myersCody
Copy link

Quick Work Around
For anyone stuck on a version of ansible less than 2.5, a good alternative to loop is with_items: https://docs.ansible.com/ansible/latest/plugins/lookup/items.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants