79 lines
2.2 KiB
YAML
79 lines
2.2 KiB
YAML
---
|
|
- name: Enable 'universe' repo (Ubuntu and Mint only)
|
|
ansible.builtin.command: add-apt-repository universe
|
|
when: ansible_facts['distribution'] in ["Ubuntu", "Linux Mint"]
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: Remove Mint's nosnap.pref block (Mint only)
|
|
ansible.builtin.file:
|
|
path: /etc/apt/preferences.d/nosnap.pref
|
|
state: absent
|
|
when: ansible_facts['distribution'] == "Linux Mint"
|
|
|
|
- name: Install Snap daemon
|
|
ansible.builtin.apt:
|
|
name: snapd
|
|
state: present
|
|
when: ansible_facts['os_family'] == "Debian"
|
|
notify: restart snapd
|
|
|
|
- name: Enable snapd socket on Debian
|
|
ansible.builtin.systemd:
|
|
name: snapd.socket
|
|
enabled: true
|
|
state: started
|
|
when: ansible_facts['distribution'] == "Debian"
|
|
|
|
- name: Force Ansible to reload facts
|
|
ansible.builtin.setup:
|
|
|
|
- name: Wait for snapd to be ready
|
|
ansible.builtin.command: snap wait system seed.loaded
|
|
register: snap_wait_result
|
|
until: snap_wait_result.rc == 0
|
|
retries: 10
|
|
delay: 5
|
|
when: ansible_facts['os_family'] == "Debian"
|
|
failed_when: false
|
|
changed_when: false
|
|
|
|
- name: Check if snap is working
|
|
ansible.builtin.command: snap list
|
|
register: snap_check
|
|
when: ansible_facts['os_family'] == "Debian"
|
|
failed_when: false
|
|
changed_when: false
|
|
|
|
- name: Install VSCode IDE (Snap, all distros)
|
|
community.general.snap:
|
|
name: code
|
|
classic: true
|
|
state: present
|
|
when:
|
|
- ansible_facts['os_family'] == "Debian"
|
|
- snap_check is defined
|
|
- snap_check.rc == 0
|
|
failed_when: false
|
|
|
|
- name: Install Cursor (Snap, all distros)
|
|
community.general.snap:
|
|
name: cursor
|
|
state: present
|
|
when:
|
|
- ansible_facts['os_family'] == "Debian"
|
|
- snap_check is defined
|
|
- snap_check.rc == 0
|
|
failed_when: false
|
|
|
|
- name: Display snap installation status
|
|
ansible.builtin.debug:
|
|
msg: |
|
|
Snap check result: {{ snap_check.rc if snap_check is defined else 'not defined' }}
|
|
VSCode and Cursor installation may have failed if snap is not properly configured.
|
|
You may need to manually install these applications or troubleshoot snap on this host.
|
|
when:
|
|
- ansible_facts['os_family'] == "Debian"
|
|
- snap_check is defined
|
|
- snap_check.rc != 0
|