add auto fetch ssl certs
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
"articleSection" : "post",
|
||||
"name" : "[ansible] 引用事先定義好的yaml檔裡面的變數 - Ansible Selectattr From List in Dictionary file",
|
||||
"headline" : "[ansible] 引用事先定義好的yaml檔裡面的變數 - Ansible Selectattr From List in Dictionary file",
|
||||
"description" : "\x3cp\x3e在ansible中,關於如何引用自定義的變數,一直讓我很頭疼\x3c\/p\x3e\n\n\x3cp\x3e尤其是有牽涉到從外部導入yaml檔案時,更是常常讓我不知道到底該怎麼抓出想要的變數\x3c\/p\x3e\n\n\x3cp\x3e這次還是用selectattr 來處理,希望下次能夠記得\x26hellip;\x3c\/p\x3e",
|
||||
"description" : "\x3cp\x3e在ansible中,關於如何引用自定義的變數,一直讓我很頭疼\x3c\/p\x3e\n\x3cp\x3e尤其是有牽涉到從外部導入yaml檔案時,更是常常讓我不知道到底該怎麼抓出想要的變數\x3c\/p\x3e\n\x3cp\x3e這次還是用selectattr 來處理,希望下次能夠記得\x26hellip;\x3c\/p\x3e",
|
||||
"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=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
|
||||
<link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
|
||||
|
||||
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'>
|
||||
<link href="https://h.cowbay.org/css/custom.css?v=1629951055" 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">
|
||||
|
||||
@@ -81,10 +81,6 @@ if (!doNotTrack) {
|
||||
|
||||
<ul id="menu-secondary-items" class="menu-secondary-items">
|
||||
|
||||
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
|
||||
<a href="/categories/"></a>
|
||||
</li>
|
||||
|
||||
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
|
||||
<a href="/categories/ansible">ansible</a>
|
||||
</li>
|
||||
@@ -309,13 +305,9 @@ if (!doNotTrack) {
|
||||
<div class="entry-content">
|
||||
<article>
|
||||
<p>在ansible中,關於如何引用自定義的變數,一直讓我很頭疼</p>
|
||||
|
||||
<p>尤其是有牽涉到從外部導入yaml檔案時,更是常常讓我不知道到底該怎麼抓出想要的變數</p>
|
||||
|
||||
<p>這次還是用selectattr 來處理,希望下次能夠記得…</p>
|
||||
|
||||
<p>首先是導入的yaml檔案,內容長這樣</p>
|
||||
|
||||
<pre><code>client_hosts:
|
||||
abc.com:
|
||||
- host: hqdc021
|
||||
@@ -357,27 +349,17 @@ if (!doNotTrack) {
|
||||
|
||||
|
||||
|
||||
</code></pre>
|
||||
|
||||
<p>在playbook中,首先先導入這個檔案</p>
|
||||
|
||||
</code></pre><p>在playbook中,首先先導入這個檔案</p>
|
||||
<pre><code>- name: load client_host
|
||||
include_vars:
|
||||
file: client_hosts.yml
|
||||
name: ch
|
||||
</code></pre>
|
||||
|
||||
<p>然後用這個剛剛導入的檔案,去做出想要的清單</p>
|
||||
|
||||
</code></pre><p>然後用這個剛剛導入的檔案,去做出想要的清單</p>
|
||||
<p>像底下這個,就是指定了client_hosts的 abc.com 這個域名底下,iuser有被定義的資料,再轉成list</p>
|
||||
|
||||
<pre><code>- name: get internet user list
|
||||
set_fact:
|
||||
iuser_list: "{{ ch['client_host']['abc.com']|selectattr('iuser','defined')|list }}"
|
||||
</code></pre>
|
||||
|
||||
<p>然後就可以用來做condition了</p>
|
||||
|
||||
</code></pre><p>然後就可以用來做condition了</p>
|
||||
<pre><code>- name: copy environment block to /etc/environment
|
||||
copy:
|
||||
content: |
|
||||
@@ -664,7 +646,7 @@ title="pinterest icon"></i>
|
||||
|
||||
</ul> <div class="design-credit">
|
||||
|
||||
<p>© 2018 Göran Svensson</p>
|
||||
<p>© 2018 Göran Svensson</p>
|
||||
|
||||
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
|
||||
|
||||
@@ -676,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=1626744134"></script>
|
||||
<script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user