update some content
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
"articleSection" : "post",
|
||||
"name" : "[筆記] ansible 設定 ssh_args 開啟 ForwardX11 \/ config ansible ssh_args to enable forwardagent",
|
||||
"headline" : "[筆記] ansible 設定 ssh_args 開啟 ForwardX11 \/ config ansible ssh_args to enable forwardagent",
|
||||
"description" : "\x3cp\x3e正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 \/ forwardagent\x3c\/p\x3e\n\x3cp\x3e總之就是在寫一隻ansible playbook\x3c\/p\x3e\n\x3cp\x3e目的是用來安裝、設定 firefox\x3c\/p\x3e\n\x3cp\x3e包含安裝 firefox addon\x3c\/p\x3e\n\x3cp\x3e但是一開始在執行的時候,碰到了一些錯誤\x3c\/p\x3e",
|
||||
"description" : "\u003cp\u003e正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 \/ forwardagent\u003c\/p\u003e\n\u003cp\u003e總之就是在寫一隻ansible playbook\u003c\/p\u003e\n\u003cp\u003e目的是用來安裝、設定 firefox\u003c\/p\u003e\n\u003cp\u003e包含安裝 firefox addon\u003c\/p\u003e\n\u003cp\u003e但是一開始在執行的時候,碰到了一些錯誤\u003c\/p\u003e",
|
||||
"inLanguage" : "en",
|
||||
"author" : "Eric Chang",
|
||||
"creator" : "Eric Chang",
|
||||
@@ -21,8 +21,8 @@
|
||||
"accountablePerson" : "Eric Chang",
|
||||
"copyrightHolder" : "Eric Chang",
|
||||
"copyrightYear" : "2019",
|
||||
"datePublished": "2019-12-24 14:41:37 \x2b0800 CST",
|
||||
"dateModified" : "2019-12-24 14:41:37 \x2b0800 CST",
|
||||
"datePublished": "2019-12-24 14:41:37 \u002b0800 CST",
|
||||
"dateModified" : "2019-12-24 14:41:37 \u002b0800 CST",
|
||||
"url" : "https:\/\/h.cowbay.org\/post\/ansible-ssh-forwardagent\/",
|
||||
"wordCount" : "382",
|
||||
"image" : "https://h.cowbay.orghttps://h.cowbay.org/images/post-default-14.jpg"",
|
||||
@@ -45,9 +45,9 @@
|
||||
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
|
||||
|
||||
<link href="https://h.cowbay.org/css/style.css?v=1632901488" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
|
||||
<link href="https://h.cowbay.org/css/style.css?v=1634607506" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
|
||||
|
||||
<link href="https://h.cowbay.org/css/custom.css?v=1632901488" rel="stylesheet" type='text/css' media='all'>
|
||||
<link href="https://h.cowbay.org/css/custom.css?v=1634607506" rel="stylesheet" type='text/css' media='all'>
|
||||
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
|
||||
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
|
||||
|
||||
@@ -311,7 +311,7 @@ if (!doNotTrack) {
|
||||
<p>但是一開始在執行的時候,碰到了一些錯誤</p>
|
||||
<h3 id="錯誤訊息">錯誤訊息</h3>
|
||||
<p>playbook 在執行時的錯誤訊息如下</p>
|
||||
<pre><code>TASK [firefox : Create profiles] *************************************************************************************************
|
||||
<pre tabindex="0"><code>TASK [firefox : Create profiles] *************************************************************************************************
|
||||
Tuesday 24 December 2019 14:28:58 +0800 (0:00:00.067) 0:00:00.946 ******
|
||||
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Exception: b'Error: no DISPLAY environment variable specified\n'
|
||||
fatal: [hqdc075]: FAILED! => {
|
||||
@@ -359,7 +359,7 @@ hqdc075 : ok=3 changed=1 unreachable=0 failed=1 s
|
||||
<p>發現可以用 ssh_args 加入-o xxxxxx</p>
|
||||
<p>可是又找不到 ssh 怎麼用這個 -o</p>
|
||||
<p>只好又回去找辣個男人問看看ssh的參數</p>
|
||||
<pre><code> -o option
|
||||
<pre tabindex="0"><code> -o option
|
||||
Can be used to give options in the format used in the configuration file. This is useful for specifying options
|
||||
for which there is no separate command-line flag. For full details of the options listed below, and their possi‐
|
||||
ble values, see ssh_config(5).
|
||||
@@ -410,15 +410,15 @@ hqdc075 : ok=3 changed=1 unreachable=0 failed=1 s
|
||||
<p>看到重點是 ForwardAgent / ForwardX11 了</p>
|
||||
<p>但是真的不曉得怎麼區分這兩種</p>
|
||||
<p>反正只有兩個,就 try and error 吧</p>
|
||||
<p>在ansible 中修改inventory file ,在想要修改的 host 後面加入 ssh_args=”-o ForwardAgent=yes”</p>
|
||||
<pre><code>hqdc075 ansible_host=192.168.11.75 ssh_args="-o ForwardAgent=yes"
|
||||
<p>在ansible 中修改inventory file ,在想要修改的 host 後面加入 ssh_args="-o ForwardAgent=yes"</p>
|
||||
<pre tabindex="0"><code>hqdc075 ansible_host=192.168.11.75 ssh_args="-o ForwardAgent=yes"
|
||||
|
||||
</code></pre><p>或者 ansible.cfg</p>
|
||||
<p>在[ssh_connection]區段中</p>
|
||||
<p>加入</p>
|
||||
<pre><code>ssh_args="-o ForwardAgent=yes"
|
||||
<pre tabindex="0"><code>ssh_args="-o ForwardAgent=yes"
|
||||
</code></pre><p>再跑一次 就看到正常執行了</p>
|
||||
<pre><code>PLAY RECAP ************************************************************************************************
|
||||
<pre tabindex="0"><code>PLAY RECAP ************************************************************************************************
|
||||
hqdc075 : ok=7 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
|
||||
|
||||
Tuesday 24 December 2019 14:37:37 +0800 (0:00:01.027) 0:00:17.879 ******
|
||||
@@ -433,7 +433,7 @@ firefox : debug ex ---- 0.07s
|
||||
|
||||
</code></pre><p>這次的過程,順便了解了ssh 加入 -X 可以在ssh session 中執行遠端主機上的圖形界面程式</p>
|
||||
<p>例如</p>
|
||||
<pre><code>ssh -X username@hostname firefox
|
||||
<pre tabindex="0"><code>ssh -X username@hostname firefox
|
||||
</code></pre><p>就可以透過ssh 執行遠端的firefox</p>
|
||||
<p>如下圖</p>
|
||||
<p><img src="https://i.imgur.com/5xoDFRe.png" alt=""></p>
|
||||
@@ -728,7 +728,7 @@ title="pinterest icon"></i>
|
||||
</div>
|
||||
<script src="https://h.cowbay.org/js/jquery.min.js"></script>
|
||||
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
|
||||
<script src="https://h.cowbay.org/js/production.min.js?v=1632901488"></script>
|
||||
<script src="https://h.cowbay.org/js/production.min.js?v=1634607506"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user