(This is a forked version that just uses ansible_ssh_user
for makepkg
)
When using ArchLinux, I typically prefer to use an AUR helper like pacaur or yaourt to automate away the process of installing a community package.
Ansible's pacman module is
great, but it doesn't support AUR packages or pacman's -U
flag.
Installing AUR packages with Ansible seemed to be left as an exercise to
the user, and since AUR helpers do not come with a fresh Arch install, I
created this set of tasks to be a reusable way of installing AUR packages
on my Arch hosts.
I should take the time to PR an AUR module for Ansible sometime soon, but this is a nice, resusable submodule for any Arch-based Ansible role.
---
- name: install yaourt on ArchLinux hosts
hosts: my_archlinux_host_group
gather_facts: yes
tasks:
- name: install package-query (a yaourt dependency)
include: aur/pkg.yml pkg_name=package-query
- name: install yaourt
include: aur/pkg.yml pkg_name=yaourt
- Add this gist as a submodule to your Ansible role or playbook
# Example ./roles directory structure for an existing Ansible playbook with a 'foobar' role
# roles/
# foobar/
# tasks/
# aur/ # Source repo added as a submodule (cloned into an `aur` directory)
# pkg.yml
$ cd ./roles/foobar/tasks
$ git submodule add https://gist.github.com/39ecb1eb1ab8ee1d0ce1.git aur
- Now
aur/pkg.yml
may be included from any task or handler within the foobar role. Given the variablespkg_name
, the tasks will validate, download, compile (as a logging-in user), and install (as root) thepkg_name
package.