# vim: set filetype=yaml.ansible : # ## Package: choose ## Description: a human-friendly and fast alternative to cut and (sometimes) awk ## Version: latest ## Methods: source ## Helpers: cargo --- - name: Set choose default facts # {{{ ansible.builtin.set_fact: choose: methods: Archlinux: [system, source] default: [source] pkgname: default: choose - name: Finalise choose default facts ansible.builtin.set_fact: choose: methods: "{{ choose.methods[os_family] | default(choose.methods.default) }}" pkgname: "{{ choose.pkgname[os_family] | default(choose.methods.default)}}" version: 1.3.7 choose_install: undefined # }}} - name: Configure choose when: - "'choose' not in __configured" block: - name: Set choose install method when: - choose_imethod is undefined ansible.builtin.set_fact: choose_imethod: "{{ imethod if imethod in choose.methods else choose.methods[0] }}" - name: Configure choose system install when: - choose_imethod == 'system' block: - name: Queue choose system install ansible.builtin.set_fact: pkg_sys: "{{ pkg_sys + [choose.pkgname] }}" choose_install: "{{ choose_imethod }}={{ choose.pkgname }}" - name: Configure choose source install when: - choose_imethod == 'source' block: - name: Configure choose cargo install ansible.builtin.set_fact: choose_cargo_install: name: choose version: "{{ choose.version }}" - name: Append choose to pkg_cargo ansible.builtin.set_fact: pkg_cargo: "{{ pkg_cargo + [choose_cargo_install] }}" choose_install: "{{ choose_imethod }}={{ choose_cargo_install }}" - name: Finalise choose configuration ansible.builtin.set_fact: __configured: "{{ __configured | combine( { 'choose': choose_install } ) }}"