# Command module and idempotancy.

**URL:** <https://forum.ansible.com/t/command-module-and-idempotancy/12943>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [June 11, 2013, 7:51am UTC](https://forum.ansible.com/t/command-module-and-idempotancy/12943 "2013-06-11T07:51:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steve\_Irvine](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@Steve\_Irvine](https://forum.ansible.com/u/Steve_Irvine)\
**Post date:** [June 11, 2013, 7:51am UTC](https://forum.ansible.com/t/command-module-and-idempotancy/12943/1 "2013-06-11T07:51:07Z")

</div>

Hi all,

I’m writing a playbook to install check\_mk.

There are packages in the Ubuntu repos but they are old. The developers provide up to date debs, so currently I use the copy module to drop the deb on the target then execute dpkg using the command module with creates=/path/to/installed/exe to give me some idempotancy.

Does this seem a reasonable course of action? It seems to work… Certainly the play shows skipped the second time it’s run. Does anyone do anything ‘cooler’ in the same situation? 🙂

I’m thinking about upgrades, with no package manager, the best I can think of is to store the current output of running the agent with --version in a var file, then when running the playbook run the agent on the target with --version and only do the upgrade if they’re different. I reckon that ought to work…

Has anyone done anything like this?

---

<div class="post-metadata">

**Author:** ![Leen\_Besselink](https://avatars.discourse-cdn.com/v4/letter/l/a183cd/32.png) [@Leen\_Besselink](https://forum.ansible.com/u/Leen_Besselink)\
**Post date:** [June 11, 2013, 8:15am UTC](https://forum.ansible.com/t/command-module-and-idempotancy/12943/2 "2013-06-11T08:15:40Z")

</div>

> Hi all,
> 
> I'm writing a playbook to install check\_mk.
> 
> There are packages in the Ubuntu repos but they are old. The developers  
> provide up to date debs, so currently I use the copy module to drop the deb  
> on the target then execute dpkg using the command module with  
> creates=/path/to/installed/exe to give me some idempotancy.
> 
> Does this seem a reasonable course of action? It seems to work... Certainly  
> the play shows skipped the second time it's run. Does anyone do anything  
> 'cooler' in the same situation? 🙂

The 'best' method is create an APT repository on a HTTP-server and add your repository key  
so it is trusted and add a file to /etc/apt/sources.list.d and use apt-get to install it.

It might take some time to set up a repository the first time, though.

In all cases the package will need to be named like 0.9.7.7irvine1 so it does not clash  
on upgrades.

0.9.7.7irvine1 is considered a higher version than 0.9.7.7 by apt/dpkg

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [June 11, 2013, 10:39am UTC](https://forum.ansible.com/t/command-module-and-idempotancy/12943/3 "2013-06-11T10:39:19Z")

</div>

+1 to the repo!

---

<div class="post-metadata">

**Author:** ![Brice\_Burgess](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@Brice\_Burgess](https://forum.ansible.com/u/Brice_Burgess)\
**Post date:** [June 11, 2013, 3:04pm UTC](https://forum.ansible.com/t/command-module-and-idempotancy/12943/4 "2013-06-11T15:04:46Z")

</div>

reprepo can be used to setup your personal repository; see:

[http://ianlawrence.info/random-stuff/setting-up-a-personal-debian-repository](http://ianlawrence.info/random-stuff/setting-up-a-personal-debian-repository)

as a reference.

---

<div class="post-metadata">

**Author:** ![Steve\_Irvine](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@Steve\_Irvine](https://forum.ansible.com/u/Steve_Irvine)\
**Post date:** [June 11, 2013, 5:46pm UTC](https://forum.ansible.com/t/command-module-and-idempotancy/12943/5 "2013-06-11T17:46:36Z")

</div>

That's really helpful, thanks very much!
