Goã®å¤æ°å®ç¾©ã®æ¸ãæ¹ã¯ããã¤ããããã¾ãã Goã®å¤æ°å®ç¾©ã¯æè»æ§ãããã¾ãã åç¬å¤æ°ã®å®ç¾© åæå¤ãªãå¤æ° å®ç¾©ï¼var å¤æ°å å¤æ°å ä¾ï¼
å®ç¾©ã®ä»æ¹ /plugins/constants.js å®æ°ãå®ç¾©ããpluginãç¨æããinjectã使ç¨ãã¦ããã¸ã§ã¯ãå ã§å ±éåãã¾ãã const COLOR_PRIMARY = '#2196F3' const SITE_DOMAIN = 'kokota_example.com' const IPA = { fe: 'åºæ¬æ å ±æè¡è 試é¨', ap: 'å¿ç¨æ å ±æè¡è 試é¨', sa: 'ã·ã¹ãã ã¢ã¼ããã¯ã試é¨', nw: 'ãããã¯ã¼ã¯ã¹ãã·ã£ãªã¹ã試é¨', db: 'ãã¼ã¿ãã¼ã¹ã¹ãã·ã£ãªã¹ã試é¨', pm: 'ããã¸ã§ã¯ãããã¼ã¸ã£è©¦é¨' } export default (context, inject) => { inject('COLOR_PRIMARY', COLOR_PRIMARY) inject('SITE_DOMAIN', SITE_DOMAIN) inject
ããã¯ã¯ã©ã¼ã(`)ã§æååä¸ã®ã³ãã³ããå®è¡ãããã¨ãã§ãã¾ãã ããã使ã£ã¦å¤æ°ã«ã³ãã³ãã®å®è¡çµæãä»£å ¥ãã¾ãã [å¤æ°å]=`ã³ãã³ã` ä¾ pwdã³ãã³ãã®çµæãå¤æ°ã®DIRã«ä»£å ¥ DIR=`pwd` ã³ãã³ãã®ãã¹ã ããã¯ã¯ã©ã¼ããããã¯ã¹ã©ãã·ã¥ã§ã¨ã¹ã±ã¼ããããã¨ã§ãã³ãã³ãã®ãã¹ããå¯è½ã«ãªãã¾ãã ä¾ pwdã³ãã³ãã®çµæã«å¯¾ãã¦"ls -ld"ãå®è¡ STR=`ls -ld \`pwd\`` æåã«å®è¡ãããã³ãã³ãã¯ã以ä¸ã®èµ¤è²ã®åæã®pwdã³ãã³ãã«ãªãã¾ãã ãã®å¾ãpwdã³ãã³ãã®çµæã«å¯¾ãã¦lsã³ãã³ããå®è¡ããã¾ãã STR=`ls -ld \`pwd\`` ããã¯ä»¥ä¸ã¨åãã«ãªãã¾ãã DIR=`pwd` STR=`ls -ld $DIR` ã³ãã³ãã®å®è¡çµæãé åã«ä»£å ¥ ã³ãã³ãã®å®è¡çµæãé åã«ããå ´åã¯ãããã¯ã¯ã©ã¼ãã§å²ãã ã³ãã³ãã"("ã¨"
ããããèª²é¡ Ansibleã§æ¡ä»¶åå²ãããã«ã¯playã®ä¸ã§whenå¥ã使ç¨ããã 1ã¤ã®true/falseã®æ¡ä»¶ããã£ã¦ããããå®è¡ãããããã®ãéãå ´åã¯playã2ã¤æ¸ããã¨ã«ãªãã ãããæ£ç´ãæ®éã®ããã°ã©ã è¨èªãªãif-elseã§æ¸ããã¨ãããplayã2ã¤ä¸¦ã¹ãªãã¨ãªããªãã¨ããã®ã¯ããããç¾ããã«æ¬ ãããå®è¡ãããããã®ãå ¨ãéããªãã¾ã è¯ãããã»ã¨ãã©ä¸ç·ãªãå°æ´ã ããã®ã»ã¨ãã©ä¸ç·ãªé¨åãä¿®æ£ããããªã£ãã2ç®æç´ããªããã°ãªããªãã ããã§ã2ã¤ãªãã¨ã¯æããªããªããããã¦true/falseã®æ¡ä»¶åå²ã3ã¤ãã£ãã¨ããããplayã8ã¤æ¸ãã£ã¦ï¼ ããã¯åå¼ãã¦æ¬²ããã ãããªæ©ã¿ãããç¨åº¦è§£æ±ºããã®ãset_factã¢ã¸ã¥ã¼ã«ã§ããã set_factã®ä½¿ãæ¹ï¼åºæ¬ç·¨ï¼ set_factã¯å¤æ°ã«å¤ãã»ããããã¢ã¸ã¥ã¼ã«ã§ããã ãã®å¤ã¯ã¹ã«ã©ã¼ã§ãã·ã¼ã¯ã¨ã³ã¹
ããããã£ãã㨠Ansibleãç¨ãã¦å®ç¾©ãããªã¹ãå¤æ°ï¼é åå¤æ°ï¼ãPlaybookå®è¡æã«ãªã¹ãå¤æ°å ã®å¤ãã¨ã«ã«ã¼ãå¦çãè¡ãããã£ãããªã¹ãå¤æ°ã§å®ç¾©ããè¤æ°ã®ååã«å¯¾ãã¦è¤æ°ãã£ã¬ã¯ããªãä½æããã¨ããå¦çãä¾ã«ã¾ã¨ãã¦ããã å®ç¾æ¹æ³ 調ã¹ããå®è¡ãã¦ã¿ããããæã以ä¸ã®3ã¤ã®æ¹æ³ããã£ãã®ã§ããããã«ã¤ãã¦è¨è¼ãã¦ããã 1. Playbookãã¡ã¤ã«ã«ç´æ¥æ¸ãæ¹æ³ï¼yamlå½¢å¼ï¼ 2. inventoryãã¡ã¤ã«ã«æ¸ãæ¹æ³ï¼yamlå½¢å¼ï¼ 3. inventoryãã¡ã¤ã«ã«æ¸ãæ¹æ³ï¼iniå½¢å¼ï¼ï¼ ã©ã®å®ç¾æ¹æ³ã以ä¸ã®æ¹æ³ã§å®è¡ãã¦ããã
ãããã¥ã¢ã«ãã·ã§ã«ã¹ã¯ãªããã使ã£ããµã¼ã管çã«èª²é¡ãæã¤æ¹ãã対象ã«ãAnsibleã®åºæ¬çãªä½¿ãæ¹ãç´¹ä»ããæ¬é£è¼ãAnsibleã§å§ãããµã¼ãä½æ¥èªååå ¥éããååã®ãAnsibleãå¹æçã«ä½¿ãã®ã«æ¬ ãããªãPlaybookã®åºæ¬çãªæ¸ãæ¹ã¾ã¨ããã¯å¤æ°ã®å©ç¨ãæ¡ä»¶åå²ã¨ãã£ãAnsibleã®ãã¬ã¤ããã¯ä½æã«æ¬ ãããªãåºæ¬çãªæ©è½ã説æãã¾ããã ä»åã¯ããè¯ããã¬ã¤ããã¯ãä½æããããããã¬ã¤ããã¯ãåå©ç¨ããããããããã®æ©è½ã¨ãããã¼ã«ãã¨å¼ã°ããæ¨å¥¨ãã£ã¬ã¯ããªæ§æãç´¹ä»ãã¾ãã ã¾ãããã¼ã«ãç¥ããã¨ã§ãå ¨ä¸çã®Ansibleã¦ã¼ã¶ã¼ããã¬ã¤ããã¯ãå ±æãããAnsible Galaxyãã¨ããã³ãã¥ããã£ãå©ç¨ã§ããããã«ãªãã¾ããAnsible Galaxyããç®çã®å¦çãè¡ãããã®ãã¬ã¤ããã¯ãè¦ã¤ããããã°ãèªåã§ãã¬ã¤ããã¯ãä½æããæéãå°ãªããªãã¾ãã
- hosts: localhost tasks: - name: add register with execute debug module debug: msg: add debug module result into debugged_register variable register: debugged_register - name: show register variable values set by execute debug module debug: msg: "{{ debugged_register }}" - name: skip execute task but register got variable debug: msg: add register of debug module result! register: not_executed_mod
ansibleã§ã¯ãã³ãã³ãå®è¡çµæãRegistered variableã«çªã£è¾¼ãã§ä¾¿å©ã«ä½¿ãã¾ã Registered Variablesã¨ã¯ï¼ ã¿ã¼ã²ãããã¹ãã§å®è¡ããã³ãã³ãã®çµæãä»»æã®å¤æ°ã«å ¥ãããã¨ãã§ãã¾ãã 使ãæ¹ãè¦ã¦ããã¾ããansibleã®ãã¼ã¸ã§ã³ã¯ 1.9.4 ã§ãã ãµã³ãã«ã¨ãã¦ãç°¡åãªplaybookãä½æãã¾ããã --- - hosts: 127.0.0.1 connection: local tasks: - name: exec whoami shell: whoami register: result - name: debug result var debug: var=result whoamiã³ãã³ãã®å®è¡çµæãregisterãã¼ã¯ã¼ãã§è¨å®ãã result å¤æ°ã«åãã次ã®debugã¿ã¹ã¯ã§ãã³ããªã³ã°ãã¾ãã å¤æ°ã®ä¸èº«ã¯ã©ããª
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}