Skip to content

Instantly share code, notes, and snippets.

@andre-brongniart
Created July 10, 2016 22:39
Show Gist options
  • Save andre-brongniart/175ac0518784f705cc388d970174b65d to your computer and use it in GitHub Desktop.
Save andre-brongniart/175ac0518784f705cc388d970174b65d to your computer and use it in GitHub Desktop.
- name: nsclient.ini-VM 32 bit
win_copy: src=templates/win_generic/nsclient.ini-VM.j2 dest=C:\Program Files\NSClient++\nsclient.ini
notify: restart nsclient 32
when:
- ansible_os_family == "Windows"
- host_type == "win_generic"
- ansible_architecture == "32-bit"
@DevOpsJr
Copy link

Hi, I am having an issue when I try to run a play - I am attempting to copy a file on the control machine (raspi) to a Windows 10 PC.

Here is what my command looks like:

root@Raspi_Ctrl:/ansible/playbook# ansible-playbook /ansible/playbook/win_copy.yml

Here is my result:

ERROR! 'when' is not a valid attribute for a Play

The error appears to have been in '/ansible/playbook/win_copy.yml': line 14, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  • name: ansible.cfg
    ^ here

This is my win_copy.yml file:

  • name: ansible.cfg
    win_copy: src=/ansible/ansible.cfg dest=C:\Users\Machine\Desktop

notify: restart nsclient 32

when:
- ansible_os_family == "Windows"
- host_type == "win_generic"

Can you tell me what I am doing incorrectly? I am also trying to figure out how to specify my target machine from the hosts file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment