<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ### 使用運行階段 > What do you get when you play country music backwards? You get your girl back, your dog back, your pick-up back, and you stop drinking. > > — Louis Saaberda 重要的是要以正確的順序做事情。 一個普遍的需求是應用一個特定的資源之前必須先應用它所依賴的所有資源 (例如,安裝一個軟件包倉庫),或者之后運行其他資源 (例如,一旦其所依賴的包都已安裝,就部署應用程序)。 Puppet 的 **run stages** 用于實現這種功能。 #### 操作步驟 1. 添加如下代碼到你的配置清單: ``` class install_repos { notify { "This will be done first": } } class deploy_app { notify { "This will be done last": } } stage { "first": before =&gt; Stage["main"] } stage { "last": require =&gt; Stage["main"] } class { "install_repos": stage =&gt; "first" } class { "deploy_app": stage =&gt; "last" } ``` 2. 運行 Puppet: ``` # puppet agent --test info: Retrieving plugin info: Caching catalog for cookbook.bitfieldconsulting.com info: Applying configuration version '1303127505' notice: This will be done first notice: /Stage[first]/Beginning/Notify[This will be done first]/ message: defined 'message' as 'This will be done first' notice: This will be done last notice: /Stage[last]/End/Notify[This will be done last]/message: defined 'message' as 'This will be done last' notice: Finished catalog run in 0.59 seconds ``` #### 工作原理 1. 首先把要做的工作根據先后順序聲明為兩個類。 ``` class install_repos { notify { "This will be done first": } } class deploy_app { notify { "This will be done last": } } ``` 2. 然后創建一個名為 first 的運行階段: ``` stage { "first": before =&gt; Stage["main"] } ``` 參數 before 指定了 first 階段必須在 main 階段(默認階段)之前完成的一切。 3. 接著創建一個名為 last 的運行階段: ``` stage { "last": require =&gt; Stage["main"] } ``` 參數 require 指定了在 last 階段之前 main 階段必須完成的一切。 4. 最后,我們引用 install_repos 和 deploy_app 兩個類, 指定他們 分別應該是 first 階段和 last 階段的一部分: ``` class { "install_repos": stage =&gt; "first" } class { "deploy_app": stage =&gt; "last" } ``` 注意我們使用的是 class 關鍵字,而不是 include 關鍵字, 就像為類傳遞參數一樣。 你能想象,作為一個參數,stage 可以被傳遞到任何類。 5. Puppet 會按照如下的順序應用 stage: ``` i. first ii. main iii. last ``` #### 更多用法 事實上,只要你喜歡你可以定義許多運行階段,并為他們安排執行順序。 這可以簡化配置清單的復雜性,否則在很大程度上就會需要很多資源之間的明確的依賴關系。 如果你可以將所有資源分為A和B兩組,A組資源必須要在B組資源之前運行完成, 這是使用運行階段的典型情況。 Gary Larizza 寫了一篇有用的關于使用運行階段的介紹文章,并結合了一些實際的例子, 網址為 [http://glarizza.posterous.com/using-run-stages-with-puppet](http://glarizza.posterous.com/using-run-stages-with-puppet) 。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看