0

I forgot how to create on localhost ( ansible svr ) directory. I'am using my ansible server as cache to download file and to copy them after that to the remote hosts.

Here example of task and playbook

tasks

- name:  Create temp folder
  file:
    path: "{{ item }}"
    state: directory
    mode: 0755
  with_items:
    - /tmp/foo/

playbook

- hosts: foo

  roles:
   - foo

Tryed with this but doesn't work:

- name:  Create temp folder
  file:
    path: "{{ item }}"
    state: directory
    mode: 0755
    remote_src: no
  with_items:
    - /tmp/foo/

Thanks

rab
  • 133
  • 2
  • 13

1 Answers1

1

I have found the solution delegate_to: localhost

- name:  Create temp folder
  file:
    path: "{{ item }}"
    state: directory
    mode: 0755
  delegate_to: localhost
  with_items:
    - /tmp/foo/
rab
  • 133
  • 2
  • 13