実現したいこと
Linux系のcurlコマンドをAnsibleのurlモジュールで実行したいのですが、
エラーとなります。
設定の仕方に誤りがあると考えていますが、修正方法が分かりません。
何かお気づきの方がいらっしゃいましたらご教授頂けないでしょうか。
宜しくお願い致します。
前提
curlコマンドの内容
1$ curl -k https://web01.hoge.co.jp/hoge.html?alive=value1 -s
ブラウザーによる実行結果の表示
{ “isAlive”: value1 }
エラーメッセージ
fatal: [web01.hoge.co.jp]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": true, "msg": "hostname 'web01.hoge.co.jp' doesn't match 'web.vip.hoge.co.jp'", "status": -1, "url": "https://web01.hoge.co.jp:4443/hoge.html"} web.vip.hoge.co.jpはVIPのweb01.hoge.co.jpに紐づいています
該当のソースコード
playbook.yml
1- name: "サービスステータスの変更" 2 ansible.builtin.uri: 3 url: https://web01.hoge.co.jp/hoge.html 4 method: POST 5 body: 6 alive: "value1"
commandモジュールにてcurlコマンドを実行した結果
playbook.yml
1ansible.builtin.command: curl -k https://hoge.web01.co.jp/hoge.html?alive=value1 -s
上記のplaybookでのcurlコマンドを実行した際の結果ログ
ok: [web01.hoge.co.jp] => { "vip_service_out": { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": true, "cmd": [ "curl", "-k", "https://web01.hoge.co.jp/hoge.html?alive=value1", "-s" ], "delta": "0:00:00.ssssss", "end": "yyyy-mm-dd HH:MM:SS.ssssss", "failed": false, "msg": "", "rc": 0, "start": "yyyy-mm-dd HH:MM:SS.ssssss", "stderr": "", "stderr_lines": [], "stdout": "{ \"isAlive\": value1 }", "stdout_lines": [ "{ \"isAlive\": value1 }" ] } }
回答1件
あなたの回答
tips
プレビュー