2017-09-29 1 views
0
TASK [teamcity_backup : Create TeamCity backup via API] ***************************************************************************************************************************** 
ok: [138.201.152.166] => {"cache_control": "no-store", "changed": false, "connection": "close", "content": "ScheduledBackup_20170929_015922.zip", "content_type": "text/plain", "cookies": {"TCSESSIONID": "99E068D2587365EA57823B81D8A2FE0A"}, "date": "Thu, 28 Sep 2017 23:59:22 GMT", "failed": false, "msg": "OK (unknown bytes)", "redirected": false, "server": "Apache-Coyote/1.1", "set_cookie": "TCSESSIONID=99E068D2587365EA57823B81D8A2FE0A; Path=/; HttpOnly, RememberMe=\"\"; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly", "status": 200, "transfer_encoding": "chunked", "url": "http://teamcity:8111/httpAuth/app/rest/server/backup?includeConfigs=true&includeDatabase=true&includeBuildLogs=false&fileName=ScheduledBackup"} 

TASK [teamcity_backup : debug] ****************************************************************************************************************************************************** 
ok: [138.201.152.166] => { 
    "data_c": "VARIABLE IS NOT DEFINED!" 
} 

ici corps de la réponse http:Ansible ne peut pas enregistrer la sortie

"content": "ScheduledBackup_20170929_015922.zip" 

data_c ne se définit pas, mais je ne comprends pas pourquoi ... Pouvez-vous me aider?

rôle/nom/tâche/main.yml:

- name: Create TeamCity backup via API 
    uri: 
    url: 'http://teamcity:8111/httpAuth/app/rest/server/backup?includeConfigs=true&includeDatabase=true&includeBuildLogs=false&fileName=ScheduledBackup' 
    method: POST 
    user: "{{ teamcity_backup_user }}" 
    password: "{{ teamcity_backup_user_password }}" 
    force_basic_auth: yes 
    return_content: yes 
    register: data_c 

- debug: var=data_c 
+0

'register' doit être sans retrait par deux espaces. C'est l'argument de la * tâche *, pas du module "uri". – larsks

Répondre

1

Il y a un problème avec l'indentation, essayez celui-ci:

- name: Create TeamCity backup via API 
    uri: 
    url: 'http://teamcity:8111/httpAuth/app/rest/server/backup?includeConfigs=true&includeDatabase=true&includeBuildLogs=false&fileName=ScheduledBackup' 
    method: POST 
    user: "{{ teamcity_backup_user }}" 
    password: "{{ teamcity_backup_user_password }}" 
    force_basic_auth: yes 
    return_content: yes 
    register: data_c 

- debug: var=data_c