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

@@ -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">
@@ -308,7 +308,7 @@ if (!doNotTrack) {
<p>尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數</p>
<p>這次還是用selectattr 來處理,希望下次能夠記得&hellip;</p>
<p>首先是導入的yaml檔案內容長這樣</p>
<pre tabindex="0"><code>client_hosts:
<pre><code>client_hosts:
abc.com:
- host: hqdc021
ipv4: 192.168.11.21
@@ -350,17 +350,17 @@ if (!doNotTrack) {
</code></pre><p>在playbook中首先先導入這個檔案</p>
<pre tabindex="0"><code>- name: load client_host
<pre><code>- name: load client_host
include_vars:
file: client_hosts.yml
name: ch
</code></pre><p>然後用這個剛剛導入的檔案,去做出想要的清單</p>
<p>像底下這個就是指定了client_hosts的 abc.com 這個域名底下iuser有被定義的資料再轉成list</p>
<pre tabindex="0"><code>- name: get internet user list
<pre><code>- name: get internet user list
set_fact:
iuser_list: &quot;{{ ch['client_host']['abc.com']|selectattr('iuser','defined')|list }}&quot;
</code></pre><p>然後就可以用來做condition了</p>
<pre tabindex="0"><code>- name: copy environment block to /etc/environment
<pre><code>- name: copy environment block to /etc/environment
copy:
content: |
PATH=&quot;/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games&quot;
@@ -658,7 +658,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>