# composer module | config command always returns changed

**URL:** <https://forum.ansible.com/t/composer-module-config-command-always-returns-changed/21616>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [May 31, 2016, 7:20pm UTC](https://forum.ansible.com/t/composer-module-config-command-always-returns-changed/21616 "2016-05-31T19:20:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Darren\_S](https://avatars.discourse-cdn.com/v4/letter/d/59ef9b/32.png) [@Darren\_S](https://forum.ansible.com/u/Darren_S)\
**Post date:** [May 31, 2016, 7:20pm UTC](https://forum.ansible.com/t/composer-module-config-command-always-returns-changed/21616/1 "2016-05-31T19:20:39Z")

</div>

OS X 10.10.5  
Python 2.7.11  
Ansible 2.0.2.0  
remote: Ubuntu 14.04.4 LTS  
remote: Python 2.7.6  
remote: PHP 5.5.9  
remote: Composer version 1.2-dev

I notice in a play with the composer module that every invocation of  
command=config to configure a certain key returns 'changed' status. Is  
this the expected outcome?

Repeatedly executing this module returns 'changed' status each time:

$ ansible example.net -m composer -a 'command=config  
arguments="vendor-dir Vendor" working\_dir=/var/www/myapp' -bv  
example.net | SUCCESS =\> {  
&nbsp;&nbsp;&nbsp;&nbsp;"changed": true,  
&nbsp;&nbsp;&nbsp;&nbsp;"msg": "Running composer as root/super user is highly discouraged  
as packages, plugins and scripts cannot always be trusted"  
}

$ ansible example.net -m composer -a 'command=config  
arguments="vendor-dir Vendor" working\_dir=/var/www/myapp' -bv  
example.net | SUCCESS =\> {  
&nbsp;&nbsp;&nbsp;&nbsp;"changed": true,  
&nbsp;&nbsp;&nbsp;&nbsp;"msg": "Running composer as root/super user is highly discouraged  
as packages, plugins and scripts cannot always be trusted"  
}

The following tasks are used in this play, and each complete fine with  
only the 'command=config' returning changed each time:

- name: composer | select cake-resque  
&nbsp;&nbsp;composer: command=require arguments='kamisama/cake-resque:4.1.2'  
working\_dir={{ app\_path }}

- name: composer | configure vendor-dir  
&nbsp;&nbsp;composer: command=config arguments='vendor-dir Vendor'  
working\_dir={{ app\_path }}

- name: composer | install something  
&nbsp;&nbsp;composer: command=install working\_dir={{ app\_path }}

I can verify that the composer.json file in the working directory has  
the following contents at the end of every run:

{  
&nbsp;&nbsp;&nbsp;&nbsp;"require": {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"kamisama/cake-resque": "4.1.2"  
&nbsp;&nbsp;&nbsp;&nbsp;},  
&nbsp;&nbsp;&nbsp;&nbsp;"config": {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"vendor-dir": "Vendor"  
&nbsp;&nbsp;&nbsp;&nbsp;}  
}

Is there anything that can prevent 'changed' status on any run of the  
task after the first?

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [May 31, 2016, 7:41pm UTC](https://forum.ansible.com/t/composer-module-config-command-always-returns-changed/21616/2 "2016-05-31T19:41:21Z")

</div>

If it is intended that the module does not do this by itself, there is  
always 'changed\_when:'...  
[https://docs.ansible.com/ansible/playbooks\_error\_handling.html#overriding-the-changed-result](https://docs.ansible.com/ansible/playbooks_error_handling.html#overriding-the-changed-result)

Johannes
