Question

I am trying to get virtualbox4.3 installed on ubuntu 12.04 using an Ansible playbook. However I am running into some problems setting the key

My playbook looks like

---
- name: add dependency manager
  apt: name=dkms
  sudo: yes

- name: add virtualbox repo for precise
  apt_repository: repo='deb http://download.virtualbox.org/virtualbox/debian precise contrib'
  sudo: yes

- name: add key
  action: command wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add -
  sudo: yes

The script complains

failed: [localhost] => {"changed": true, "cmd": ["wget", "-q", "http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc", "-O-", "|", "apt-key", "add", "-"], "delta": "0:00:00.709146", "end": "2014-02-28 10:23:29.718311", "item": "", "rc": 4, "start": "2014-02-28 10:23:29.009165"} stdout: -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.9 (GNU/Linux) mQGiBEv ... etc

Any suggestions? I guess I am making a mistake with the add key part, but it is not clear to me what is wrong. I have based my script on the following apt instruction http://www.howopensource.com/2013/04/install-virtualbox-ubuntu-ppa/.

Was it helpful?

Solution

Instead of action: command block, consider using Ansible's native apt_key: module as documented in http://docs.ansible.com/apt_key_module.html.

In your specific case it would be:

- name: add VirtualBox repo signing key
  apt_key: state=present
           url=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top