---
- name: Clone Jira issue and link to cloned issue
  hosts: localhost
  gather_facts: false
  vars:
    config_file: "{{ lookup('env', 'HOME') ~ '/.config/jira.yml' }}"
    config: "{{ lookup('file', config_file) | from_yaml }}"
    current: "{{ config['current'] }}"
    url: "{{ config[current]['url'] }}"
    token: "{{ config[current]['token'] }}"
    project: "{{ config[current]['project'] }}"
    component: "{{ config[current]['component'] }}"
    product: "{{ config[current]['product'] }}"
    pool_team: "{{ config[current]['pool_team'] }}"
  module_defaults:
    community.general.jira:
      project: "{{ project }}"
      token: "{{ token }}"
      uri: "{{ url }}"
  tasks:
    - name: Clone issue and link issue
      include_tasks: tasks/clone_and_link_issue.yml
