# Ansible on Freebsd with pkgng

**URL:** <https://forum.ansible.com/t/ansible-on-freebsd-with-pkgng/16761>\
**Category:** Ansible Project\
**Created:** [November 12, 2014, 9:11pm UTC](https://forum.ansible.com/t/ansible-on-freebsd-with-pkgng/16761 "2014-11-12T21:11:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laurentius\_Purba](https://avatars.discourse-cdn.com/v4/letter/l/7cd45c/32.png) [@Laurentius\_Purba](https://forum.ansible.com/u/Laurentius_Purba)\
**Post date:** [November 12, 2014, 9:11pm UTC](https://forum.ansible.com/t/ansible-on-freebsd-with-pkgng/16761/1 "2014-11-12T21:11:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Marcus\_Jaschen](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@Marcus\_Jaschen](https://forum.ansible.com/u/Marcus_Jaschen)\
**Post date:** [November 16, 2014, 6:42pm UTC](https://forum.ansible.com/t/ansible-on-freebsd-with-pkgng/16761/2 "2014-11-16T18:42:48Z")

</div>

> 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  
> &nbsp;&nbsp;remote\_user: jdoe  
> &nbsp;&nbsp;sudo: yes  
> &nbsp;&nbsp;tasks:  
> &nbsp;&nbsp;&nbsp;&nbsp;- name: Upgrade php5  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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  
&nbsp;&nbsp;&nbsp;remote\_user: jdoe  
&nbsp;&nbsp;&nbsp;sudo: yes  
&nbsp;&nbsp;&nbsp;tasks:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- name: Uninstall php5  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pkgng: name=lang/php5 state=absent  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- name: Install php5  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pkgng: name=lang/php5 state=present cached=no

Marcus

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [November 17, 2014, 8:32pm UTC](https://forum.ansible.com/t/ansible-on-freebsd-with-pkgng/16761/3 "2014-11-17T20:32:35Z")

</div>

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.
