I would like to use ansible also to upgrade all installed packages on a host. Checking ansible's documentation for pkgng, it looks easy enough, so I created this little playbook:
and a tasks file for the role:
the first task works fine, it updates pkg. However, the second part does not. Looking into it, ansible does this:
which looks fine, but if you try it on a host it doesn't work:
or variations thereof, depending on if there are normal files in root's home directory or not. It would be easy if you could just specify an empty name to ansible, but that doesn't work either.
So how do other people using ansible on FreeBSD hosts handle this?
Code:
tingo@kg-core2$ cat fbsd-pkg-upgrade.yml
# upgrade all installed packages
- hosts: all
roles:
- fbsd-upgrade
Code:
tingo@kg-core2$ cat roles/fbsd-upgrade/tasks/main.yml
- name: pkg upgrade pkg
tags: pkg-upgrade
become: yes
pkgng:
name: pkg
state: latest
- name: pkg upgrade all packages
tags: nginx
become: yes
pkgng:
name: "*"
state: latest
# /usr/sbin/pkg upgrade -g -U -y *
which looks fine, but if you try it on a host it doesn't work:
Code:
root@proxy:~ # pkg upgrade -g -U *
pkg: No match.
Code:
name: (ansible throws an error)
name: "\*" (ansible says syntax error)
name: "" (no complaints, but doesn't work)