mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
9027c367d4
pacman: support yay as root (#6713)
* pacman: support yay as root
* make pylint happy
* minor adjustments
* rollback some test actions
* removal of user and pkgs in handlers
* add comment to note
* add changelog frag
* fix doc
* Update tests/integration/targets/pacman/tasks/yay-become.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* Update tests/integration/targets/pacman/tasks/yay-become.yml
Co-authored-by: Felix Fontein <felix@fontein.de>
* simplify pkg install in int. tests
---------
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit f6ee2177a2
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
66 lines
1.8 KiB
YAML
66 lines
1.8 KiB
YAML
---
|
|
# Copyright (c) Ansible Project
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
# This is more convoluted that one might expect, because:
|
|
# - yay is not available or installation in ArchLinux (as it is in Manjaro - issue 6184 reports using it)
|
|
# - to install yay in ArchLinux requires building the package
|
|
# - makepkg cannot be run as root, but the user running it must have sudo to install the resulting package
|
|
|
|
- name: create user
|
|
ansible.builtin.user:
|
|
name: yaybuilder
|
|
state: present
|
|
notify: Remove user yaybuilder
|
|
|
|
- name: grant sudo powers to builder
|
|
community.general.sudoers:
|
|
name: yaybuilder
|
|
user: yaybuilder
|
|
commands: ALL
|
|
nopassword: true
|
|
|
|
- name: Install base packages
|
|
ansible.builtin.package:
|
|
name:
|
|
- base-devel
|
|
- git
|
|
- go
|
|
state: present
|
|
notify: Remove packages for yay-become
|
|
|
|
- name: Hack permssions for the remote_tmp_dir
|
|
ansible.builtin.file:
|
|
path: "{{ remote_tmp_dir }}"
|
|
mode: '0777'
|
|
|
|
- name: Create temp directory for builder
|
|
ansible.builtin.file:
|
|
path: "{{ remote_tmp_dir }}/builder"
|
|
owner: yaybuilder
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: clone yay git repo
|
|
become: true
|
|
become_user: yaybuilder
|
|
ansible.builtin.git:
|
|
repo: https://aur.archlinux.org/yay.git
|
|
dest: "{{ remote_tmp_dir }}/builder/yay"
|
|
depth: 1
|
|
|
|
- name: make package
|
|
become: true
|
|
become_user: yaybuilder
|
|
ansible.builtin.command:
|
|
chdir: "{{ remote_tmp_dir }}/builder/yay"
|
|
cmd: makepkg -si --noconfirm
|
|
notify: Remove yay
|
|
|
|
- name: Install nmap
|
|
community.general.pacman:
|
|
name: nmap
|
|
state: present
|
|
executable: yay
|
|
extra_args: --builddir /var/cache/yay
|