From 9a17894bc90f3c81b3b8c4e9785979aac26b7f3f Mon Sep 17 00:00:00 2001 From: Matthew Stobbs Date: Tue, 25 Mar 2025 13:49:53 -0600 Subject: [PATCH] write debug lists to files --- tasks/main.yml | 72 +++++++++++++++++++++++++---------------- tasks/pkgs/starship.yml | 2 +- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index 8154bf6..2b4e63a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -73,79 +73,93 @@ when: - ansible_system == 'Linux' - pkg_appimage|length > 0 - ansible.builtin.debug: - var: pkg_appimage + ansible.bulitin.copy: + content: "{{ pkg_appimage | to_yaml }}" + file: "{{ d_tempdir.path }}/pkg_appimage.yml" - name: List archives when: - pkg_archive|length > 0 - ansible.builtin.debug: - var: pkg_debug + ansible.bulitin.copy: + content: "{{ pkg_archive | to_yaml }}" + file: "{{ d_tempdir.path }}/pkg_archive.yml" - name: List cargo when: - pkg_cargo|length > 0 - ansible.builtin.debug: - var: pkg_cargo + ansible.bulitin.copy: + content: "{{ pkg_cargo | to_yaml }}" + file: "{{ d_tempdir.path }}/pkg_cargo.yml" - name: List casks when: - ansible_system == 'Darwin' - pkg_cask|length > 0 - ansible.builtin.debug: - var: pkg_cask + ansible.bulitin.copy: + content: "{{ pkg_cask | to_yaml }}" + file: "{{ d_tempdir.path }}/pkg_cask.yml" - name: List flatpak remotes when: - ansible_system == 'Linux' - flatpak_remote|length > 0 - ansible.builtin.debug: - var: flatpak_remote + ansible.bulitin.copy: + content: "{{ flatpak_remote | to_yaml }}" + file: "{{ d_tempdir.path }}/flatpak_remote.yml" - name: List flatpaks when: - ansible_system == 'Linux' - pkg_flatpak|length > 0 - ansible.builtin.debug: - var: pkg_flatpak + ansible.bulitin.copy: + content: "{{ pkg_flatpak | to_yaml }}" + file: "{{ d_tempdir.path }}/pkg_flatpak.yml" - name: List go when: - pkg_go|length > 0 - ansible.builtin.debug: - var: pkg_go + ansible.bulitin.copy: + content: "{{ pkg_go | to_yaml }}" + file: "{{ d_tempdir.path }}/pkg_go.yml" - name: List npm when: - pkg_npm|length > 0 - ansible.builtin.debug: - var: pkg_npm + ansible.bulitin.copy: + content: "{{ pkg_npm | to_yaml }}" + file: "{{ d_tempdir.path }}/pkg_npm.yml" - name: List pipx when: - pkg_pipx|length > 0 - ansible.builtin.debug: - var: pkg_pipx + ansible.bulitin.copy: + content: "{{ pkg_pipx | to_yaml }}" + file: "{{ d_tempdir.path }}/pkg_pipx.yml" - name: List source when: - pkg_src|length > 0 - ansible.builtin.debug: - var: pkg_src + ansible.bulitin.copy: + content: "{{ pkg_src | to_yaml }}" + file: "{{ d_tempdir.path }}/pkg_src.yml" - name: List system when: - pkg_sys|length > 0 - ansible.builtin.debug: - var: pkg_sys + ansible.bulitin.copy: + content: "{{ pkg_sys | to_yaml }}" + file: "{{ d_tempdir.path }}/pkg_sys.yml" - name: List homebrew taps when: - ansible_system == 'Darwin' - brewtap|length > 0 - ansible.builtin.debug: - var: brewtap + ansible.bulitin.copy: + content: "{{ brewtap | to_yaml }}" + file: "{{ d_tempdir.path }}/brewtap.yml" - name: List taps when: - ansible_system == 'Darwin' - pkg_tap|length > 0 - ansible.builtin.debug: - var: pkg_tap + ansible.bulitin.copy: + content: "{{ pkg_tap | to_yaml }}" + file: "{{ d_tempdir.path }}/pkg_tap.yml" - name: List snaps when: - ansible_system == 'Linux' - pkg_snap|length > 0 - ansible.builtin.debug: - var: pkg_snap + ansible.bulitin.copy: + content: "{{ pkg_snap | to_yaml }}" + file: "{{ d_tempdir.path }}/pkg_snap.yml" - name: Flush handlers to ensure dependencies are installed ansible.builtin.meta: flush_handlers @@ -241,6 +255,8 @@ file: "src/{{ pkg }}.yml" - name: Cleanup {{ d_tempdir.path }} + when: + - not debug ansible.builtin.file: state: absent path: "{{ d_tempdir.path }}" diff --git a/tasks/pkgs/starship.yml b/tasks/pkgs/starship.yml index 0e79948..0c42b3a 100644 --- a/tasks/pkgs/starship.yml +++ b/tasks/pkgs/starship.yml @@ -9,7 +9,7 @@ - Depend cargo changed_when: true ansible.builtin.set_fact: - pkg_cargo: "{{ pkg_cargo + ['starship'] }}" + pkg_cargo: "{{ pkg_cargo + [{'name': 'starship', 'locked': true}] }}" - name: Set starship_configured ansible.builtin.set_fact: