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.



On Fri, Jul 8, 2022 at 9:53 AM Todd Lewis <[email protected]> wrote:

> 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.
>
> On Friday, July 8, 2022 at 12:34:33 PM UTC-4 [email protected] wrote:
>
>> 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
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/PUJL9ortatY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/c2989980-f6ee-4bc8-b26b-dec49a78d2b5n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/c2989980-f6ee-4bc8-b26b-dec49a78d2b5n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CALmkhkrg42pdL9mO4kA0UbDQXngQJ_x0_jqx063E%2BRKzg8UJ0Q%40mail.gmail.com.

Reply via email to