---
# this file included by fastd-community.yml, which is included in a loop,
# called seperately for each community
# => configure fastd for one community here
# hash describing community expected as "mf_com"; also expected: "f_ssh_keyfile"

#- debug: var=mf_com

#- debug: var=f_ssh_keyfile

- name: prepare secure temp dir
  command: mktemp -d --tmpdir ansible-tmp-mf{{mf_com.abbreviation}}.XXXXXXXXXX
  register: tmpdir

- set_fact:
    mf_com_repo: "{{tmpdir.stdout}}"
    mf_com_templ: "fastd.conf-meshing"

- include: fastd-config.yml

- name: git add new public key
  command: git add servers
           chdir="{{mf_com_repo}}"

- name: git commit new public key
  command: git commit -m "add {{ansible_hostname}}"
           chdir="{{mf_com_repo}}"

- name: git push new public key
  command: git push
           chdir="{{mf_com_repo}}"

- name: clean up
  file: path="{{mf_com_repo}}" state=absent