update some content
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
"articleSection" : "post",
|
||||
"name" : "[筆記] inxi 蒐集詳盡的硬體資訊 \/ inxi Collect Detail Hardware Info",
|
||||
"headline" : "[筆記] inxi 蒐集詳盡的硬體資訊 \/ inxi Collect Detail Hardware Info",
|
||||
"description" : "\x3cp\x3e最近因為一直碰到硬碟故障的問題,算起來那一批同時購買的5X顆 seagate 2T硬碟,已經有一半以上故障返修了\x26hellip;.\x3c\/p\x3e\n\x3cp\x3e然後又因為一直沒有添購新的硬碟,只能用這些快過保\/已過保的撐著\x3c\/p\x3e\n\x3cp\x3e所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!\x3c\/p\x3e\n\x3cp\x3e也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了\x3c\/p\x3e\n\x3cp\x3e然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!\x3c\/p\x3e",
|
||||
"description" : "\u003cp\u003e最近因為一直碰到硬碟故障的問題,算起來那一批同時購買的5X顆 seagate 2T硬碟,已經有一半以上故障返修了\u0026hellip;.\u003c\/p\u003e\n\u003cp\u003e然後又因為一直沒有添購新的硬碟,只能用這些快過保\/已過保的撐著\u003c\/p\u003e\n\u003cp\u003e所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!\u003c\/p\u003e\n\u003cp\u003e也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了\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-04-23 15:28:56 \x2b0800 CST",
|
||||
"dateModified" : "2019-04-23 15:28:56 \x2b0800 CST",
|
||||
"datePublished": "2019-04-23 15:28:56 \u002b0800 CST",
|
||||
"dateModified" : "2019-04-23 15:28:56 \u002b0800 CST",
|
||||
"url" : "https:\/\/h.cowbay.org\/post\/inx-collect-detail-hardware-info\/",
|
||||
"wordCount" : "286",
|
||||
"image" : "https://h.cowbay.orghttps://h.cowbay.org/images/post-default-10.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=1632901489" 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=1632901489" 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">
|
||||
|
||||
@@ -326,63 +326,63 @@ if (!doNotTrack) {
|
||||
<p>所以同樣的task 要跑兩次,一個要帶sudo 一個不用帶</p>
|
||||
<p>然後BSD系列的機器,在inventory 裡面要帶入 ansible_ssh_user</p>
|
||||
<p>就這樣,沒有什麼太困難的</p>
|
||||
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-YAML" data-lang="YAML"><span style="color:#75715e">######### use inxi instead ##################</span>
|
||||
- <span style="color:#66d9ef">name</span>: copy inxi binary to remote Ubnutu/Debian
|
||||
<span style="color:#66d9ef">become</span>: yes
|
||||
<span style="color:#66d9ef">become_method</span>: sudo
|
||||
<span style="color:#66d9ef">copy</span>:
|
||||
<span style="color:#66d9ef">src</span>: inxi
|
||||
<span style="color:#66d9ef">dest</span>: /usr/local/bin/inxi
|
||||
<span style="color:#66d9ef">mode</span>: a+rx,u+rwx
|
||||
<span style="color:#66d9ef">when</span>: ansible_distribution == <span style="color:#e6db74">"Ubuntu"</span> or ansible_distribution == <span style="color:#e6db74">"Debian"</span> or ansible_distribution == <span style="color:#e6db74">"CentOS"</span>
|
||||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-YAML" data-lang="YAML"><span style="color:#75715e">######### use inxi instead ##################</span>
|
||||
- <span style="color:#f92672">name</span>: <span style="color:#ae81ff">copy inxi binary to remote Ubnutu/Debian</span>
|
||||
<span style="color:#f92672">become</span>: <span style="color:#66d9ef">yes</span>
|
||||
<span style="color:#f92672">become_method</span>: <span style="color:#ae81ff">sudo</span>
|
||||
<span style="color:#f92672">copy</span>:
|
||||
<span style="color:#f92672">src</span>: <span style="color:#ae81ff">inxi</span>
|
||||
<span style="color:#f92672">dest</span>: <span style="color:#ae81ff">/usr/local/bin/inxi</span>
|
||||
<span style="color:#f92672">mode</span>: <span style="color:#ae81ff">a+rx,u+rwx</span>
|
||||
<span style="color:#f92672">when</span>: <span style="color:#ae81ff">ansible_distribution == "Ubuntu" or ansible_distribution == "Debian" or ansible_distribution == "CentOS"</span>
|
||||
|
||||
- <span style="color:#66d9ef">name</span>: copy inxi binary to remote FreeBSD
|
||||
<span style="color:#66d9ef">copy</span>:
|
||||
<span style="color:#66d9ef">src</span>: inxi
|
||||
<span style="color:#66d9ef">dest</span>: /usr/local/bin/inxi
|
||||
<span style="color:#66d9ef">mode</span>: a+rx,u+rwx
|
||||
<span style="color:#66d9ef">when</span>: ansible_distribution == <span style="color:#e6db74">"FreeBSD"</span>
|
||||
- <span style="color:#f92672">name</span>: <span style="color:#ae81ff">copy inxi binary to remote FreeBSD</span>
|
||||
<span style="color:#f92672">copy</span>:
|
||||
<span style="color:#f92672">src</span>: <span style="color:#ae81ff">inxi</span>
|
||||
<span style="color:#f92672">dest</span>: <span style="color:#ae81ff">/usr/local/bin/inxi</span>
|
||||
<span style="color:#f92672">mode</span>: <span style="color:#ae81ff">a+rx,u+rwx</span>
|
||||
<span style="color:#f92672">when</span>: <span style="color:#ae81ff">ansible_distribution == "FreeBSD"</span>
|
||||
|
||||
- <span style="color:#66d9ef">name</span>: run inxi to collect Ubuntu/Debian hardware info
|
||||
<span style="color:#66d9ef">become</span>: yes
|
||||
<span style="color:#66d9ef">become_method</span>: sudo
|
||||
<span style="color:#66d9ef">shell</span>: <span style="color:#e6db74">"/usr/local/bin/inxi -c -Dxx -C -m -Z"</span>
|
||||
<span style="color:#66d9ef">register</span>: du_hw_info
|
||||
<span style="color:#66d9ef">when</span>: ansible_distribution == <span style="color:#e6db74">"Ubuntu"</span> or ansible_distribution == <span style="color:#e6db74">"Debian"</span> or ansible_distribution == <span style="color:#e6db74">"CentOS"</span>
|
||||
- <span style="color:#f92672">name</span>: <span style="color:#ae81ff">run inxi to collect Ubuntu/Debian hardware info</span>
|
||||
<span style="color:#f92672">become</span>: <span style="color:#66d9ef">yes</span>
|
||||
<span style="color:#f92672">become_method</span>: <span style="color:#ae81ff">sudo</span>
|
||||
<span style="color:#f92672">shell</span>: <span style="color:#e6db74">"/usr/local/bin/inxi -c -Dxx -C -m -Z"</span>
|
||||
<span style="color:#f92672">register</span>: <span style="color:#ae81ff">du_hw_info</span>
|
||||
<span style="color:#f92672">when</span>: <span style="color:#ae81ff">ansible_distribution == "Ubuntu" or ansible_distribution == "Debian" or ansible_distribution == "CentOS"</span>
|
||||
|
||||
- <span style="color:#66d9ef">name</span>: run inxi to collect FreeBSD hardware info
|
||||
<span style="color:#66d9ef">shell</span>: <span style="color:#e6db74">"/usr/local/bin/inxi -c -Dxx -C -m -Z"</span>
|
||||
<span style="color:#66d9ef">register</span>: bsd_hw_info
|
||||
<span style="color:#66d9ef">when</span>: ansible_distribution == <span style="color:#e6db74">"FreeBSD"</span>
|
||||
- <span style="color:#f92672">name</span>: <span style="color:#ae81ff">run inxi to collect FreeBSD hardware info</span>
|
||||
<span style="color:#f92672">shell</span>: <span style="color:#e6db74">"/usr/local/bin/inxi -c -Dxx -C -m -Z"</span>
|
||||
<span style="color:#f92672">register</span>: <span style="color:#ae81ff">bsd_hw_info</span>
|
||||
<span style="color:#f92672">when</span>: <span style="color:#ae81ff">ansible_distribution == "FreeBSD"</span>
|
||||
|
||||
- <span style="color:#66d9ef">name</span>: set Ubuntu/Debian inventory file
|
||||
<span style="color:#66d9ef">template</span>:
|
||||
<span style="color:#66d9ef">src</span>: etc/inventory.txt.j2
|
||||
<span style="color:#66d9ef">dest</span>: <span style="color:#e6db74">"/tmp/{{ ansible_hostname }}_inventory.txt"</span>
|
||||
<span style="color:#66d9ef">mode</span>: a+r,u+rw
|
||||
<span style="color:#66d9ef">when</span>: ansible_distribution == <span style="color:#e6db74">"Ubuntu"</span> or ansible_distribution == <span style="color:#e6db74">"Debian"</span> or ansible_distribution == <span style="color:#e6db74">"CentOS"</span>
|
||||
- <span style="color:#f92672">name</span>: <span style="color:#ae81ff">set Ubuntu/Debian inventory file</span>
|
||||
<span style="color:#f92672">template</span>:
|
||||
<span style="color:#f92672">src</span>: <span style="color:#ae81ff">etc/inventory.txt.j2</span>
|
||||
<span style="color:#f92672">dest</span>: <span style="color:#e6db74">"/tmp/{{ ansible_hostname }}_inventory.txt"</span>
|
||||
<span style="color:#f92672">mode</span>: <span style="color:#ae81ff">a+r,u+rw</span>
|
||||
<span style="color:#f92672">when</span>: <span style="color:#ae81ff">ansible_distribution == "Ubuntu" or ansible_distribution == "Debian" or ansible_distribution == "CentOS"</span>
|
||||
|
||||
- <span style="color:#66d9ef">name</span>: set FreeBSD inventory file
|
||||
<span style="color:#66d9ef">template</span>:
|
||||
<span style="color:#66d9ef">src</span>: etc/freenas_inventory.txt.j2
|
||||
<span style="color:#66d9ef">dest</span>: <span style="color:#e6db74">"/tmp/{{ ansible_hostname }}_inventory.txt"</span>
|
||||
<span style="color:#66d9ef">mode</span>: a+r,u+rw
|
||||
<span style="color:#66d9ef">when</span>: ansible_distribution == <span style="color:#e6db74">"FreeBSD"</span>
|
||||
- <span style="color:#f92672">name</span>: <span style="color:#ae81ff">set FreeBSD inventory file</span>
|
||||
<span style="color:#f92672">template</span>:
|
||||
<span style="color:#f92672">src</span>: <span style="color:#ae81ff">etc/freenas_inventory.txt.j2</span>
|
||||
<span style="color:#f92672">dest</span>: <span style="color:#e6db74">"/tmp/{{ ansible_hostname }}_inventory.txt"</span>
|
||||
<span style="color:#f92672">mode</span>: <span style="color:#ae81ff">a+r,u+rw</span>
|
||||
<span style="color:#f92672">when</span>: <span style="color:#ae81ff">ansible_distribution == "FreeBSD"</span>
|
||||
|
||||
- <span style="color:#66d9ef">name</span>: send inventory file via mail
|
||||
<span style="color:#66d9ef">tags</span>: mail
|
||||
<span style="color:#66d9ef">mail</span>:
|
||||
<span style="color:#66d9ef">host</span>: <span style="color:#ae81ff">192.168.11.173</span>
|
||||
<span style="color:#66d9ef">port</span>: <span style="color:#ae81ff">25</span>
|
||||
<span style="color:#66d9ef">secure</span>: starttls
|
||||
<span style="color:#66d9ef">subject</span>: <span style="color:#e6db74">"{{ ansible_hostname }} inventory file"</span>
|
||||
<span style="color:#66d9ef">from</span>: ansible
|
||||
<span style="color:#66d9ef">to</span>: <span style="color:#e6db74">"{{ recipient }}"</span>
|
||||
- <span style="color:#f92672">name</span>: <span style="color:#ae81ff">send inventory file via mail</span>
|
||||
<span style="color:#f92672">tags</span>: <span style="color:#ae81ff">mail</span>
|
||||
<span style="color:#f92672">mail</span>:
|
||||
<span style="color:#f92672">host</span>: <span style="color:#ae81ff">192.168.11.173</span>
|
||||
<span style="color:#f92672">port</span>: <span style="color:#ae81ff">25</span>
|
||||
<span style="color:#f92672">secure</span>: <span style="color:#ae81ff">starttls</span>
|
||||
<span style="color:#f92672">subject</span>: <span style="color:#e6db74">"{{ ansible_hostname }} inventory file"</span>
|
||||
<span style="color:#f92672">from</span>: <span style="color:#ae81ff">ansible</span>
|
||||
<span style="color:#f92672">to</span>: <span style="color:#e6db74">"{{ recipient }}"</span>
|
||||
<span style="color:#75715e">#body: "{{ mail_body.stdout_lines }}"</span>
|
||||
<span style="color:#66d9ef">attach</span>: <span style="color:#e6db74">"/tmp/{{ ansible_hostname }}_inventory.txt"</span>
|
||||
<span style="color:#f92672">attach</span>: <span style="color:#e6db74">"/tmp/{{ ansible_hostname }}_inventory.txt"</span>
|
||||
|
||||
</code></pre></div><p>inventory 內容</p>
|
||||
<pre><code>hqs01.abc.com ansible_ssh_host=192.168.11.1
|
||||
<pre tabindex="0"><code>hqs01.abc.com ansible_ssh_host=192.168.11.1
|
||||
hqs210.abc.com
|
||||
hqs230.abc.com
|
||||
hqs231.abc.com
|
||||
@@ -690,7 +690,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=1632901489"></script>
|
||||
<script src="https://h.cowbay.org/js/production.min.js?v=1634607506"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user