Ansible on Freebsd with pkgng

Hello all,

I have question regarding pkgng for FreeBSD.

The idea is I was trying to update php on one of our development servers. The current php version installed is 5.4.28, while we have on the port (/usr/ports/lang/php5) is 5.4.34.

Below is the playbook that I have:

  • hosts: 10.0.21.99
    remote_user: jdoe
    sudo: yes
    tasks:
  • name: Upgrade php5
    pkgng: name=lang/php5 state=present cached=yes

From the command line, I executed the following with the output:
$> ansible-playbook /etc/ansible/config/roles/common/tasks/php-upgrade.yml -K

sudo password:

PLAY [10.0.21.99] *************************************************************

GATHERING FACTS ***************************************************************
ok: [10.0.21.99]

TASK: [Upgrade php5] **********************************************************
ok: [10.0.21.99]

PLAY RECAP ********************************************************************
10.0.21.99 : ok=2 changed=0 unreachable=0 failed=0

My question is, why I cannot upgrade my php version from what is install 5.4.28 to 5.434, even though I already use the cached=yes option.

Thanks for your help, guys.

-Laurentius

Hello all,

I have question regarding pkgng for FreeBSD.

The idea is I was trying to update php on one of our development
servers. The current php version installed is 5.4.28, while we have on
the port (/usr/ports/lang/php5) is 5.4.34.

Below is the playbook that I have:

- hosts: 10.0.21.99
  remote_user: jdoe
  sudo: yes
  tasks:
    - name: Upgrade php5
      pkgng: name=lang/php5 state=present cached=yes

Hi Laurentius,

other package manager modules (i. e. 'apt') support a `state=latest`
option for upgrading already installed packages.

According to the docs the pkgng unfortunately doesn't support the
`latest` option for the `state` parameter.

I don't know much about how pkgng works but maybe you can upgrade PHP if
you uninstall the package first and afterwards re-install it. I don't
have a FreeBSD box here, so I can't test it now…

- hosts: 10.0.21.99
   remote_user: jdoe
   sudo: yes
   tasks:
     - name: Uninstall php5
       pkgng: name=lang/php5 state=absent
     - name: Install php5
       pkgng: name=lang/php5 state=present cached=no

Marcus

If it makes sense, I’d be quite open to whatever it takes to make ‘latest’ work here.

It is, I will say, not a primary OS for us – but it’s one we’re definitely committed to enabling development on.