---
- hosts: all
  vars:
    facts: True
  gather_facts: "{{facts}}"
  tasks:
    - local_action: file path="{{tmpdir}}/data" state=directory
      run_once: yes
    - local_action: template src=host-tpl.j2 dest="{{tmpdir}}/data/{{inventory_hostname}}"

---
- hosts: all

  vars:
    facts: True

  gather_facts: "{{ facts }}"

  tasks:
    - name: "Ensure tmpdir data directory"
      file:
        path: "{{ tmpdir }}/data"
        state: directory
      become: no
      run_once: yes
      delegate_to: localhost

    - name: "Template the gathered facts"
      template:
        src: host-tpl.j2
        dest: "{{ tmpdir }}/data/{{ inventory_hostname }"
      delegate_to: localhost
      become: no

Fix fact playbook when "become=true" in ansible.cfg
Fix fact playbook when "become=true" in ansible.cfg

gather-hosts.yml creates files owned by root when the ansible.cfg contains "become: true". By setting "become: no" on the task level the files are created by the rundeck user.
+
new syntax
