- name: make a new ssl ticketkey
  hosts: batcave01.phx2.fedoraproject.org
  user: root

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - "/srv/private/ansible/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"

  tasks:
  - name: create new production ticket key
    command: /usr/local/bin/generate_ticketkey /root/ticketkey_production.tkey fpprod

  - name: create new staging ticket key
    command: /usr/local/bin/generate_ticketkey /root/ticketkey_staging.tkey fpstag

- name: Push out new ticket key
  hosts: proxies:proxies-stg
  user: root

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - "/srv/private/ansible/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"

  tasks:

  - name: deploy ticket key
    copy: src=/root/ticketkey_{{env}}.tkey dest=/etc/httpd/ticketkey_{{env}}.tkey
          owner=root group=root mode=0600
    notify:
    - reload proxyhttpd
