aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/yay/tasks/main.yml
blob: cc3729a8336340d3a02fc1ebd4104d5d579dcac7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
- name: Collect installed packages
  ansible.builtin.package_facts:
    manager: pacman

- name: Install yay
  when: |
    'yay' not in ansible_facts.packages
  block:
    - name: Create temporary directory
      ansible.builtin.tempfile:
        prefix: yay
        state: directory
      register: yay_dir

    - name: Checkout & build
      block:
        - name: Checkout
          # noqa: latest[git]
          # This is supposed to always work, per the project's README.
          ansible.builtin.git:
            repo: 'https://aur.archlinux.org/yay.git'
            dest: '{{ yay_dir.path }}'
            accept_hostkey: true

        - name: Build
          ansible.builtin.command:
            cmd: makepkg --install --syncdeps --rmdeps --noconfirm
            chdir: '{{ yay_dir.path }}'
          changed_when: true

      always:
        - name: Clean up
          ansible.builtin.file:
            path: '${{ yay_dir.path }}'
            state: absent