Dear community,
I’m using ansible in version 1.2 in combination with debian 6.0
In one playbook I’m doing a step that does grep the name of the user who owns this domain:
- name: get domain and db user
action: script …/scripts/get_user.sh $DOMAIN
register: USER
ignore_errors: True
The output is for example peter.
The next step is:
- name: delete user and group
action: shell deluser -f {{USER.stdout}}
On my testing system all does work well … in the production system (debian 6.0 , ansible 1.2) I get an error:
TASK: [delete user and group] *************************************************
failed: [productionsystem] => {“changed”: true, “cmd”: "deluser -f peter\r\n ", “delta”: “0:00:00.061755”, “end”: “2013-07-07 19:31:45.344276”, “rc”: 2, “start”: “2013-07-07 19:31:45.282521”}
’ does not exist./deluser: The user `peter
FATAL: all hosts have already failed – aborting
First issue is , that \r\n got into USER.stdout (on one system , not on the other one)
Second is that this ’ does not exist./deluser: The user `peter , should be:
deluser: The user `peter’ does not exist.
It get shrinked. Why ( this is just a question of interest in ansible or how ansible works)
Does anyone have any suggestions or ideas? What am I doing wrong.
Thank you in advance