---
- include_tasks: utils/once/flag.yml
- name: "π Refuse a flavor the role does not carry"
ansible.builtin.assert:
that:
- code_flavor in code_flavors
fail_msg: "services.code.flavor is '{{ code_flavor }}'; carried flavors are {{ code_flavors.keys() | list | join(', ') }}."
quiet: true
- name: "π§Ή Remove the flavors that conflict with {{ code_flavor }}"
package_install: # nocheck: package-install removes the flavors other than the configured one, the batch only installs
id: "{{ item }}"
state: absent
loop: "{{ code_conflicting_flavors }}"
- name: "π¦ install {{ code_flavor }}"
package_install: # nocheck: package-install installs only the configured flavor, the role removes the others
id: "{{ code_flavor }}"
register: code_install
- name: "π§© Install the extension of an agent this host deploys"
ansible.builtin.command:
cmd: "{{ code_binary }} --install-extension {{ item.value.config.extension_id }} --force"
become: true
become_user: "{{ lookup('users', WORKSTATION_USER).username }}"
register: code_extension
changed_when: "'successfully installed' in (code_extension.stdout | lower)"
loop: "{{ code_addons | dict2items }}"
loop_control:
label: "{{ item.key }}"
when:
- code_install is not skipped
- item.value.enabled | bool