# Auto accept license pkgin

**URL:** <https://forum.ansible.com/t/auto-accept-license-pkgin/14523>\
**Category:** Ansible Project\
**Created:** [February 7, 2014, 9:08pm UTC](https://forum.ansible.com/t/auto-accept-license-pkgin/14523 "2014-02-07T21:08:15Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Wolstenholme](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@Paul\_Wolstenholme](https://forum.ansible.com/u/Paul_Wolstenholme)\
**Post date:** [February 7, 2014, 9:08pm UTC](https://forum.ansible.com/t/auto-accept-license-pkgin/14523/1 "2014-02-07T21:08:15Z")

</div>

Are there any tricks to installing a package with a license acceptance requirement. I’m using pkgin to install sun-jre and it is failing. I was just wondering if anyone has any suggestions for auto-accepting the sun license agreement.

Cheers,  
Paul

---

<div class="post-metadata">

**Author:** ![Erik\_Anderson](https://avatars.discourse-cdn.com/v4/letter/e/71c47a/32.png) [@Erik\_Anderson](https://forum.ansible.com/u/Erik_Anderson)\
**Post date:** [February 7, 2014, 9:12pm UTC](https://forum.ansible.com/t/auto-accept-license-pkgin/14523/2 "2014-02-07T21:12:35Z")

</div>

If you're on ubuntu or debian, you just need to issue these commands before  
installing the package:

$ echo debconf shared/accepted-oracle-license-v1-1 select true | \  
&nbsp;&nbsp;sudo debconf-set-selections  
$ echo debconf shared/accepted-oracle-license-v1-1 seen true | \  
&nbsp;&nbsp;sudo debconf-set-selections

-Erik

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [February 7, 2014, 9:24pm UTC](https://forum.ansible.com/t/auto-accept-license-pkgin/14523/3 "2014-02-07T21:24:49Z")

</div>

I’m assuming BSD, you probably have to add to the ACCEPTABLE\_LICENSES variable (check BSD distro for where to do so). Adding it to environment: on your task might even work.

---

<div class="post-metadata">

**Author:** ![Erik\_Anderson](https://avatars.discourse-cdn.com/v4/letter/e/71c47a/32.png) [@Erik\_Anderson](https://forum.ansible.com/u/Erik_Anderson)\
**Post date:** [February 7, 2014, 9:26pm UTC](https://forum.ansible.com/t/auto-accept-license-pkgin/14523/4 "2014-02-07T21:26:30Z")

</div>

Missed that. Nevermind my email.

...perhaps it may be useful in the future for debian/ubuntu types. 🙂

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [February 7, 2014, 9:28pm UTC](https://forum.ansible.com/t/auto-accept-license-pkgin/14523/5 "2014-02-07T21:28:45Z")

</div>

@erik, I’m in last stages of getting a debconf module accepted, so I hope that even that won’t be the case 😉

---

<div class="post-metadata">

**Author:** ![Erik\_Anderson](https://avatars.discourse-cdn.com/v4/letter/e/71c47a/32.png) [@Erik\_Anderson](https://forum.ansible.com/u/Erik_Anderson)\
**Post date:** [February 7, 2014, 9:29pm UTC](https://forum.ansible.com/t/auto-accept-license-pkgin/14523/6 "2014-02-07T21:29:32Z")

</div>

That is \*great\* news. Thanks for your work in it!

---

<div class="post-metadata">

**Author:** ![Paul\_Wolstenholme](https://avatars.discourse-cdn.com/v4/letter/p/e47c2d/32.png) [@Paul\_Wolstenholme](https://forum.ansible.com/u/Paul_Wolstenholme)\
**Post date:** [February 8, 2014, 1:00am UTC](https://forum.ansible.com/t/auto-accept-license-pkgin/14523/7 "2014-02-08T01:00:49Z")

</div>

Thanks everyone. I’m running pkgin on Smartos. I added the ACCEPTABLE\_LICENSES (ACCEPTABLE\_LICENSES= sun-jre) to the mk.conf file in /opt/local/share/mk folder. Works great.

But I think setting an environment variable in the ansible is easier. In my case, I set it in the role vars file.

license\_env:  
ACCEPTABLE\_LICENSES: ‘sun-jre6’

And then in the task:

- name: Install Java  
pkgin: name=sun-jre6 state=present  
environment: license\_env  
tags: logstash

Thanks,  
Paul
