- name: Set Launchpad username
  command: "{{ janitor_code_path }}/breezy/brz lp-login {{ item.username }}"
  when: "item.kind == 'launchpad'"
  with_items: "{{ janitor_hoster_credentials }}"
- name: Launchpad consumer key
  command: python3 -c "from breezy.plugins.launchpad.lp_api import get_auth_engine; print(get_auth_engine('https://api.launchpad.net/').unique_consumer_id)"
  register: lp_consumer_key
  environment:
    PYTHONPATH: "{{ janitor_code_path }}/breezy"
  # TODO(jelmer): actually set launchpad credentials
- name: Set GitLab credentials
  template:
    src: gitlab.conf
    mode: 0700
    owner: "{{ janitor_user }}"
    dest: "{{ janitor_home }}/.config/breezy/gitlab.conf"
  when: "item.kind == 'gitlab'"
  with_items: "{{ janitor_hoster_credentials }}"
- name: Set GitHub credentials
  blockinfile:
    path: "{{ janitor_home }}/.config/breezy/github.conf"
    mode: 0700
    owner: "{{ janitor_user }}"
    block: |
      "{{ item.private_token }}"
  when: "item.kind == 'github'"
  with_items: "{{ janitor_hoster_credentials }}"
