Ich führe ein ansible Playbook, das jenkins installiert und cli.jar ausführen muss, um mehrere Skripte auszuführen. Es benötigt einen jnlp-Port, den ich über den Befehl anshable shell einrichten möchte. Aber es scheint zu versagen.Wie jnlp Port in Jenkins über die Befehlszeile festlegen?
- name: Set jnlp port
shell: 'curl -X POST -d ".useSecurity=on&slaveAgentPort.type=fixed&value=49187&core%3Aapply=true&json=%7B%22useSecurity%22%3A+%7B%22slaveAgentPort%22%3A+%7B%22type%22%3A+%22fixed%22%2C+%22value%22%3A+%2249187%22%7D%7D%2C+%22core%3Aapply%22%3A+%22true%22%7D" --header "Content-Type:application/x-www-form-urlencoded" http://localhost:8080//configureSecurity/configure'
remote_user: jenkins
become: yes
become_method: sudo
mit -vvv Optionen Laufen gibt:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/vagrant/ansible/roles/jenkins1.648/tasks/plugins.yml': line 37, column 370, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Check update center and push it to the update URL
shell: 'curl -X POST -d .useSecurity=on&slaveAgentPort.type=fixed&value=49187&core%3Aapply=true&json=%7B%22useSecurity%22%3A+%7B%22slaveAgentPort%22%3A+%7B%22type%22%3A+%22fixed%22%2C+%22value%22%3A+%2249187%22%7D%7D%2C+%22core%3Aapply%22%3A+%22true%22%7D" --header "Content-Type:application/x-www-form-urlencoded" http://localhost:8080//configureSecurity/configure' -vvv
^here
This one looks easy to fix. It seems that there is a value started
with a quote, and the YAML parser is expecting to see the line ended
with the same kind of quote. For instance:
when: "ok" in result.stdout
Could be written as:
when: '"ok" in result.stdout'
Or equivalently:
when: "'ok' in result.stdout"
We could be wrong, but this one looks like it might be an issue with
unbalanced quotes. If starting a value with a quote, make sure the
line ends with the same set of quotes. For instance this arbitrary
example:
foo: "bad" "wolf"
Could be written as:
foo: '"bad" "wolf"'
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
@techraf: Ja, es funktioniert, wenn ich es von der Kommandozeile aus nur versuchen, zu –
@techraf ich -vvv nach curl Befehl endet am hinzugefügt wird. Können Sie bitte erarbeiten, wie Sie es erwarten ansible sein –
Okay, ich setzen möchte nur TCP/jnlp Port in jenkins und die gleiche curl Befehl funktioniert direkt, aber nicht mit. Ich versuche eine Lösung zu finden, warum es scheitert. –