---
# linux-postinstall LaTeX

- name: Install packages
  apt: >
    name="{{ item }}"
    state="present"
  with_items:
    - texlive-full
  when: ansible_os_family == "Debian"
  tags: lp_latex_packages

- name: Create directory /usr/share/texmf/tex/latex
  file: >
    state="directory"
    path="/usr/share/texmf/tex/latex/"
  tags: lp_latex_dir

- name: Create directories for macros
  file: >
    state="directory"
    path="{{ item.dest }}"
  with_items: "{{ lp_latex_macros }}"
  tags: lp_latex_macros
  when: lp_latex_macros > 0

- name: Download macros
  get_url: >
    url="{{ item.url }}"
    dest="{{ item.dest }}"
    timeout="{{ lp_latex_download_timeout }}"
  with_items: "{{ lp_latex_macros }}"
  tags: lp_latex_labels
  when: lp_latex_macros > 0
  ignore_errors: "{{ lp_latex_get_url_ignore_errors }}"

# TODO:
# 1) Compile and register labels.sty
# cd /usr/share/texmf/tex/latex/labels/
# latex labels.ins
# texhash /usr/share/texmf

# EOF
...

---
# linux-postinstall LaTeX

- name: Install packages
  apt: >
    name="{{ item }}"
    state="present"
  with_items:
    - texlive-full
  when: ansible_os_family == "Debian"
  tags: lp_latex_packages

- name: Create directory /usr/share/texmf/tex/latex
  file: >
    state="directory"
    path="/usr/share/texmf/tex/latex/"
  tags: lp_latex_dir

- name: Create directories for macros
  file: >
    state="directory"
    path="{{ item.dest }}"
  with_items: "{{ lp_latex_macros }}"
  when: lp_latex_macros > 0
  tags: lp_latex_macros

- name: Download macros
  get_url: >
    url="{{ item.url }}"
    dest="{{ item.dest }}"
    timeout="{{ lp_latex_download_timeout }}"
  with_items: "{{ lp_latex_macros }}"
  when: lp_latex_macros > 0
  ignore_errors: "{{ lp_latex_get_url_ignore_errors }}"
  changed_when: false
  tags: lp_latex_labels
# get_url: check mode reports changes with force enabled
# https://github.com/ansible/ansible/issues/25418

# TODO:
# 1) Compile and register labels.sty
# cd /usr/share/texmf/tex/latex/labels/
# latex labels.ins
# texhash /usr/share/texmf

# EOF
...

Stop get_url reporting changes in the check mode.
Stop get_url reporting changes in the check mode.
