Hi, I'm trying to update user accounts on a number of linux hosts vi a dict containing the users. Here's a sample vars:
"user_accounts": [ { "testusr": { "gecos": "Test User", "grp": "wheel", "pass": "123abc", "status": "enabled", "username": "testusr" } } ] Here's the play: - name: Sync User Accounts (create) user: name: "{{ item['username'] }}" comment: "{{ item['gecos'] }}" password: "{{ item['pass'] | default('notavalidpassword') }}" group: "{{ item['grp'] | default('') }}" shell: "{{ item['shell'] | default('/bin/bash') }}" update_password: always state: present when: "{{ item['status'] }}" == 'enabled' with_items: - "{{ user_accounts }}" tags: users I'm getting a syntax error: The offending line appears to be: state: present when: "{{ item['status'] }}" == 'enabled' ^ 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: Any ideas? Dan -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f2b79ec3-8cf4-4be7-8ab0-040cc2f473f0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.