# apt-repository not working in debian squeeze

**URL:** <https://forum.ansible.com/t/apt-repository-not-working-in-debian-squeeze/11912>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [September 20, 2012, 8:21am UTC](https://forum.ansible.com/t/apt-repository-not-working-in-debian-squeeze/11912 "2012-09-20T08:21:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edu\_el\_Ligre](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@Edu\_el\_Ligre](https://forum.ansible.com/u/Edu_el_Ligre)\
**Post date:** [September 20, 2012, 8:21am UTC](https://forum.ansible.com/t/apt-repository-not-working-in-debian-squeeze/11912/1 "2012-09-20T08:21:08Z")

</div>

Hi there,

I got a {“failed”: true, “msg”: “Failed to find required executable add-apt-repository”} error when trying to add a repository with apt-repository module on debian squeeze. I found out add-apt-repository is ubuntu specific.

I am using 7.0, is that limitation in place or am I doing something wrong? May be a note on the modules page would make sense in any case.

As a workaround I am trying to add the repository this way, but the command fails in with “~/dotdeb.gpg Not such file or directory” Same command works if run directly on the machine

- name: Copy dotdeb.list to sources list  
action: copy src=files/etc/apt/dotdeb/dotdeb.list dest=/etc/apt/sources.list.d/dotdeb.list  
tags:

- common

- setup

- packages

- name: Copy dotdeb public key to home  
action: copy src=files/etc/apt/dotdeb/dotdeb.gpg dest=~/dotdeb.gpg  
tags:

- common

- setup

- packages

- name: Add the dotdeb public key to a new keyring  
action: command /usr/bin/gpg --no-default-keyring --keyring /etc/apt/trusted.gpg.d/dotdeb.gpg --import ~/dotdeb.gpg – creates=/etc/apt/trusted.gpg.d/dotdeb.gpg  
tags:

- common

- setup

- packages

Any idea about what is wrong? Also, I am not an experienced sysadmin, so maybe copy should include some attributes for owner and permissions. I am running this as root.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 20, 2012, 12:20pm UTC](https://forum.ansible.com/t/apt-repository-not-working-in-debian-squeeze/11912/2 "2012-09-20T12:20:39Z")

</div>

I am not a user of this module. If Debian/Ubuntu users can help investigate and fix, that would be great -- thanks!

-- Michael

---

<div class="post-metadata">

**Author:** ![Stephen\_Fromm](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Stephen\_Fromm](https://forum.ansible.com/u/Stephen_Fromm)\
**Post date:** [September 20, 2012, 4:18pm UTC](https://forum.ansible.com/t/apt-repository-not-working-in-debian-squeeze/11912/3 "2012-09-20T16:18:39Z")

</div>

add-apt-repository comes in the package python-software-properties on ubuntu. For reasons unclear to me, python-software-properties on debian does not include this script. It appears add-apt-repository is ubuntu-specific.

sf

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 20, 2012, 5:45pm UTC](https://forum.ansible.com/t/apt-repository-not-working-in-debian-squeeze/11912/4 "2012-09-20T17:45:31Z")

</div>

Am aware. So no interest in making it work without that binary? Or perhaps just have a “hey this doesn’t work on your OS” message.

– Michael

---

<div class="post-metadata">

**Author:** ![Stephen\_Fromm](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Stephen\_Fromm](https://forum.ansible.com/u/Stephen_Fromm)\
**Post date:** [September 21, 2012, 3:53pm UTC](https://forum.ansible.com/t/apt-repository-not-working-in-debian-squeeze/11912/5 "2012-09-21T15:53:57Z")

</div>

Since the docs didn’t mention it was ubuntu-specific, I assumed it would work on debian. I can submit a patch for the docs, but I’m not sure what changes I’d make to the module. Do other debian derivatives include add-apt-repository?

sf

---

<div class="post-metadata">

**Author:** ![Marco\_Vito\_Moscarito](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@Marco\_Vito\_Moscarito](https://forum.ansible.com/u/Marco_Vito_Moscarito)\
**Post date:** [September 24, 2012, 8:13am UTC](https://forum.ansible.com/t/apt-repository-not-working-in-debian-squeeze/11912/6 "2012-09-24T08:13:47Z")

</div>

> > Am aware. So no interest in making it work without that binary? Or  
> > perhaps just have a "hey this doesn't work on your OS" message.
> 
> Since the docs didn't mention it was ubuntu-specific, I assumed it would  
> work on debian. I can submit a patch for the docs, but I'm not sure what  
> changes I'd make to the module. Do other debian derivatives include  
> add-apt-repository?

I'm not debian user (sorry) but i find this script that can help you:

\* [http://blog.anantshri.info/howto-add-ppa-in-debian/](http://blog.anantshri.info/howto-add-ppa-in-debian/)  
\* [http://blog.anantshri.info/content/uploads/2010/09/add-apt-repository.sh.txt](http://blog.anantshri.info/content/uploads/2010/09/add-apt-repository.sh.txt)

You can try to use template to copy script (probably some small change  
are required) and use apt\_repository to manage your repo.

> sf

Bye  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Marco

---

<div class="post-metadata">

**Author:** ![Edu\_el\_Ligre](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@Edu\_el\_Ligre](https://forum.ansible.com/u/Edu_el_Ligre)\
**Post date:** [September 24, 2012, 8:32pm UTC](https://forum.ansible.com/t/apt-repository-not-working-in-debian-squeeze/11912/7 "2012-09-24T20:32:41Z")

</div>

– Sorry, I cross-posted this to the list digest. It belongs here –

Hi there,

Thanks for all your comments. It seems like apt-add-repository was  
added to python-software-properties in version 0.75. The current  
version in Debian Stable ('squeeze") is 0.60, so it doesn’t have it  
[1].

Anyways, the work-arround I was trying finally worked after changing  
the commnad target directory from ~ to /tmp/. Adding a new repo is  
just three tasks, so I rather do it this way than through an extra  
script. This is are the tasks that are working from me right now.

tasks:

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 24, 2012, 8:43pm UTC](https://forum.ansible.com/t/apt-repository-not-working-in-debian-squeeze/11912/8 "2012-09-24T20:43:19Z")

</div>

There's an outstanding pull request here:

[https://github.com/izhukov/ansible/commit/03f8db55d6b9447af1509e522ed2d5b92ea6eb60](https://github.com/izhukov/ansible/commit/03f8db55d6b9447af1509e522ed2d5b92ea6eb60)

Anyone with preferences want to help review?

If it's available in \*newer\* Debian I'm inclined to say we could  
possibly ignore this?

Presumably it should use the apt-add-repository code if installed.

--Michael

---

<div class="post-metadata">

**Author:** ![Eduardo\_Esclapes\_Gim](https://avatars.discourse-cdn.com/v4/letter/e/e274bd/32.png) [@Eduardo\_Esclapes\_Gim](https://forum.ansible.com/u/Eduardo_Esclapes_Gim)\
**Post date:** [September 25, 2012, 6:20am UTC](https://forum.ansible.com/t/apt-repository-not-working-in-debian-squeeze/11912/9 "2012-09-25T06:20:56Z")

</div>

> There's an outstanding pull request here:
> 
> [https://github.com/izhukov/ansible/commit/03f8db55d6b9447af1509e522ed2d5b92ea6eb60](https://github.com/izhukov/ansible/commit/03f8db55d6b9447af1509e522ed2d5b92ea6eb60)

I have tried to review and test, but seems like I am having some  
difficulties, commented on the issue:

[https://github.com/ansible/ansible/pull/1082#issuecomment-8844382](https://github.com/ansible/ansible/pull/1082#issuecomment-8844382)

> Presumably it should use the apt-add-repository code if installed.

I believe this pull request does not use apt-add-repository at all.

Cheers
