copy file to one host only

I am trying to copy a file to one host. the file will be on my ansible host I am copying over to the remote host

do I need to create a file folder and put the file I want copied there

project
├── hosts
├── main.yml
└── roles
└── poc
├── files
│ └── cluster.yml
├── tasks
│ └── main.yml
└── vars
└── main.yml

Your question is a little vague without invoking the “read-my-mind” module.
If you’re talking about on the Ansible controller, you already have the file in a director: roles/poc/files/cluster.yml
If you’re asking about on the target host, if the directory already exists, you can just copy it with the copy module. Otherwise you’ll need to use the file module to ensure the target directory exists before you can copy it there.

Thank you here is a snippet and it works fine with the file in the file folder structure

  • name: copy cluster file to jumphost
    become: true
    copy:
    src: “cluster.yml”
    dest: “/home/rke”
    owner: “{{ username }}”
    group: “{{ username }}”
    mode: ‘0644’

but I want to only run this on a single host and not all hosts.

keep getting this

ERROR! conflicting action statements: hosts, copy

when I add

hosts: gui

At the same indentation level as “copy:”, you want something like
when: ansible_host == gui

Or, if “gui” is a group
when: “‘gui’ in group_names”

The “w” of “when” and the “c” of “copy” should be in the same column.