update some content

This commit is contained in:
2021-10-28 14:15:01 +08:00
parent b8600ab259
commit 27b5a11382
163 changed files with 951 additions and 922 deletions

View File

@@ -13,7 +13,7 @@
"articleSection" : "post",
"name" : "[筆記] 為了保存log 用script 指令執行ansible \/ Another Way to Keep Ansible Log using script command",
"headline" : "[筆記] 為了保存log 用script 指令執行ansible \/ Another Way to Keep Ansible Log using script command",
"description" : "\u003cp\u003e之前為了能夠在執行完 ansible playbook 後能有個log 可以看\u003c\/p\u003e\n\u003cp\u003e所以在每次執行的時候都要加入 tee 的指令\u003c\/p\u003e\n\u003cp\u003e像是\u003c\/p\u003e\n\u003cpre tabindex=\u00220\u0022\u003e\u003ccode\u003eANSIBLE_CONFIG=\/home\/D\/ansiblecontrol\/ansible.cfg \/usr\/local\/bin\/ansible-playbook \/home\/D\/ansiblecontrol\/playbook.user_client.yml --vault-password-file=\/home\/D\/ansiblecontrol\/vault.passwd -i \/home\/D\/ansiblecontrol\/inventory\/production -f1 --limit tyuserclients |tee \/tmp\/tyuserclients.log\n\u003c\/code\u003e\u003c\/pre\u003e\u003cp\u003e一直都是放在crontab 裡面執行,也就沒有去管他\u003c\/p\u003e\n\u003cp\u003e反正也沒有人關心結果怎樣 (攤手\u003c\/p\u003e",
"description" : "\u003cp\u003e之前為了能夠在執行完 ansible playbook 後能有個log 可以看\u003c\/p\u003e\n\u003cp\u003e所以在每次執行的時候都要加入 tee 的指令\u003c\/p\u003e\n\u003cp\u003e像是\u003c\/p\u003e\n\u003cpre\u003e\u003ccode\u003eANSIBLE_CONFIG=\/home\/D\/ansiblecontrol\/ansible.cfg \/usr\/local\/bin\/ansible-playbook \/home\/D\/ansiblecontrol\/playbook.user_client.yml --vault-password-file=\/home\/D\/ansiblecontrol\/vault.passwd -i \/home\/D\/ansiblecontrol\/inventory\/production -f1 --limit tyuserclients |tee \/tmp\/tyuserclients.log\n\u003c\/code\u003e\u003c\/pre\u003e\u003cp\u003e一直都是放在crontab 裡面執行,也就沒有去管他\u003c\/p\u003e\n\u003cp\u003e反正也沒有人關心結果怎樣 (攤手\u003c\/p\u003e",
"inLanguage" : "en",
"author" : "Eric Chang",
"creator" : "Eric Chang",
@@ -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=1634607506" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/style.css?v=1635401692" rel="stylesheet" id="theme-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 href="https://h.cowbay.org/css/custom.css?v=1635401692" 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">
@@ -307,12 +307,12 @@ if (!doNotTrack) {
<p>之前為了能夠在執行完 ansible playbook 後能有個log 可以看</p>
<p>所以在每次執行的時候,都要加入 tee 的指令</p>
<p>像是</p>
<pre tabindex="0"><code>ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log
<pre><code>ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log
</code></pre><p>一直都是放在crontab 裡面執行,也就沒有去管他</p>
<p>反正也沒有人關心結果怎樣 (攤手</p>
<p>後來發現有個指令叫 script 可以完整紀錄指令執行期間的console 畫面變化(包含了ansi color!)</p>
<p>剛剛測試了一下,發現的確是可以用,不過也沒感覺有特別好用的地方,就只是做個紀錄吧,說不定以後其他地方可以用得到</p>
<pre tabindex="0"><code>sciprt -c 'make EXTRA_ARGS=&quot;-i inventory/production --limit hqpc074&quot; user_client' -f hqpc074.out'
<pre><code>sciprt -c 'make EXTRA_ARGS=&quot;-i inventory/production --limit hqpc074&quot; user_client' -f hqpc074.out'
</code></pre><p>結果長這樣
<img src="https://i.imgur.com/F9KFAWV.png" alt=""></p>
<p>就真的跟console 的畫面一樣</p>
@@ -602,7 +602,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=1634607506"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1635401692"></script>
</body>
</html>