- hosts: all
  tasks:
    - name: Collect yaml2ical output
      synchronize:
        dest: "{{ zuul.executor.work_root }}/yaml2ical"
        mode: pull
        src: "{{ zuul.projects['opendev.org/opendev/irc-meetings'].src_dir }}/output/"
        verify_host: true

- hosts: localhost
  tasks:
    - name: Add eavesdrop.o.o to inventory
      add_host:
        name: eavesdrop.openstack.org
        ansible_python_interpreter: python3
        ansible_user: zuul

- hosts: localhost
  tasks:
    - name: Add eavesdrop.o.o hostkey to known hosts
      known_hosts:
        name: eavesdrop.openstack.org
        key: "eavesdrop.openstack.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDldndjk19Adb9KJECZrR5UdZc/h1kbpO8UlxC1a12Sh3LcIQPUW+VUPvzqne2mV27E75phI7CFW60xrS1f6YM8Yxb36541x26OZMeMU1XitACvrbXXUCgws+a8ikoCqNnqkIA/ObLXnCb2gX2yvRTndbNXbCZmvHyoQ2TDN3J9irRoWU42N56O6Pw4BHJ9h/mwAWFDvxmUxVaHivg9gA5ytXn1dgw5tJo1SoX97gajQ6CfbRThfXrqNlJyLHT/+FlW+JFqyRmsuH1Nu7tXD73uXKe4nm+K0Sum289jhHaVO1BNu6TIguQOR2o5psBE//u4DzhpEEdrgIe1v80fx51P"

- hosts: eavesdrop.openstack.org
  gather_facts: False
  tasks:

    - name: Upload index files
      copy:
        src: "{{ zuul.executor.work_root }}/yaml2ical/{{ item }}"
        dest: "/srv/yaml2ical/{{ item }}"
      with_items:
        - index.html
        - irc-meetings.ical

    - name: Copy calendars
      synchronize:
        src: "{{ zuul.executor.work_root }}/yaml2ical/calendars/"
        dest: "/srv/yaml2ical/calendars"