Apache 2.4 failing to install from ports in FreeBSD

I have tried

  • name: Install apache from ports
    portinstall: name=apache24

and

  • name: Install apache from ports
    portinstall: name=www/apache24

And every time it crashes with:

-------------- error

fatal: [test1] => failed to parse: Traceback (most recent call last):
File “/root/.ansible/tmp/ansible-tmp-1401356164.88-83095021216464/portinstall”, line 1407, in
main()
File “/root/.ansible/tmp/ansible-tmp-1401356164.88-83095021216464/portinstall”, line 200, in main
install_packages(module, pkgs, p[“use_packages”])
File “/root/.ansible/tmp/ansible-tmp-1401356164.88-83095021216464/portinstall”, line 170, in install_packages
matches = matching_packages(module, package)
File “/root/.ansible/tmp/ansible-tmp-1401356164.88-83095021216464/portinstall”, line 104, in matching_packages
occurrences = int(parts[0])
ValueError: invalid literal for int() with base 10: ‘www/apache24’

FATAL: all hosts have already failed – aborting

-------------- error

Any ideas why?
Installing manually works without problems

Adding higher levels of verbosity:

TASK: [freebsd-django | Install apache from ports] ****************************
<162.242.223.246> ESTABLISH CONNECTION FOR USER: root
<162.242.223.246> REMOTE_MODULE portinstall name=www/apache24
<162.242.223.246> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=2222’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘162.242.223.246’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1401357126.38-269635003321609 && echo $HOME/.ansible/tmp/ansible-tmp-1401357126.38-269635003321609’”]
<162.242.223.246> PUT /tmp/tmpgLsOxv TO /root/.ansible/tmp/ansible-tmp-1401357126.38-269635003321609/portinstall
<162.242.223.246> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘Port=2222’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘ConnectTimeout=10’, ‘162.242.223.246’, “/bin/sh -c ‘/usr/local/bin/python /root/.ansible/tmp/ansible-tmp-1401357126.38-269635003321609/portinstall; rm -rf /root/.ansible/tmp/ansible-tmp-1401357126.38-269635003321609/ >/dev/null 2>&1’”]
fatal: [test1] => failed to parse: Traceback (most recent call last):
File “/root/.ansible/tmp/ansible-tmp-1401357126.38-269635003321609/portinstall”, line 1407, in
main()
File “/root/.ansible/tmp/ansible-tmp-1401357126.38-269635003321609/portinstall”, line 200, in main
install_packages(module, pkgs, p[“use_packages”])
File “/root/.ansible/tmp/ansible-tmp-1401357126.38-269635003321609/portinstall”, line 170, in install_packages
matches = matching_packages(module, package)
File “/root/.ansible/tmp/ansible-tmp-1401357126.38-269635003321609/portinstall”, line 104, in matching_packages
occurrences = int(parts[0])
ValueError: invalid literal for int() with base 10: ‘www/apache24’

FATAL: all hosts have already failed – aborting

Solved
Was missing
state=present

It should default to that and not stacktrace, it is still a bug.

Have to do more testing today… I think it was crashing even after adding that…
Will git pull latest code… and retry

I suspect it is the version matching code, often a headache for those dealing with FreeBSD packages.

Brian Coca

Tracebacks are bugs, so please file this regardless.