ã¬ãããããã®ææã§ããAnsible ã®ãã¯ãã«ã«ãµãã¼ãããã¦ãã¾ããæ¯æ1ã¤ã¯ä½ãæ¸ããã¨ãç®æ¨ã«ãã¦ãã¾ãã
ä»æ㯠Ansible Automation Controller (æ§ç§° Ansible Tower) ã§æ±ãããã¸ã§ã¯ãã«ã¤ãã¦ãç¹ã« Git ã¨ã®é£æºã®è¦³ç¹ããå°ã 解説ãããã¨æãã¾ããä»å㯠Controller 4.0.0 ã§èª¬æãã¾ãããå¾æ¥ã® Ansible Tower 3.8 ã§ãæ°æ©è½ãæ°ç»é¢ãé¤ãã¦ã¯åæ§ã®åãããã¾ãã
ããã¸ã§ã¯ãã«å«ã¾ãããã®
ããã¸ã§ã¯ã㯠Ansible ãå®è¡ãããã¨ããå¦çãã¾ã¨ãããã£ã¬ã¯ããªããã¡ã¤ã«ã§ããä¾ãæããã¨ãã®ãããªæ§æã«ãªã£ã¦ãã¾ãããã¬ã¤ããã¯ããã¤ãããã¯ã¤ã³ãã³ããªã®ããã®å®ç¾©ãªã©ãå«ã¾ãã¦ãã¾ãã
Controller ã®ãµã¼ãä¸ã§ã¯ã/var/lib/awx/projects/ ãã£ã¬ã¯ããªä»¥ä¸ã«æ ¼ç´ããã¾ããããã¸ã§ã¯ãã¯ã¸ã§ããå®è¡ãããã³ã« /tmp ãã£ã¬ã¯ããªã«ã¾ããã¨ã³ãã¼ãããè¤æ°ã®ã¸ã§ããèµ·åãã¦ããäºãã«å½±é¿ããªãããã«ãªã£ã¦ãã¾ãã
ãã®æ¯åã¾ããã¨ã³ãã¼ãããä»æ§ã¯ãã¸ã§ãéã®ãªã½ã¼ã¹ã®ç«¶åã«ããããã¯ãã§ããã ãæé¤ããããã« Tower 3.6 ããå°å ¥ããã¾ããããã®ãããããã¸ã§ã¯ãã®ãã£ã¬ã¯ããªã¯å¤§ããããããªãããã«ãããã¨ããå§ããã¾ããä¾ãã° GBytes ã®å¤§ããã«ããªã OS ã® ISO ã¤ã¡ã¼ã¸ãããã¸ã§ã¯ãå ã«ç½®ãã¦ããã¨ãããããªä½¿ãæ¹ã¯é¿ããããã«ãã¦ãã ããã
ããã¸ã§ã¯ãã¯ã½ã¼ã¹ã³ã³ããã¼ã«ã·ã¹ãã (SCM) ããåå¾ãã¦ç®¡çãããã¨ãæ³å®ããã¦ãã¾ããããã¤ãã®ç¨®é¡ã«å¯¾å¿ãã¦ãã¾ãã
- Manual (ç´æ¥ãã£ã¬ã¯ããªã /var/lib/awx/projects/ 以ä¸ã«ä½æãã¦é ç½®)
- Git
- Subversion
- Red Hat Insights (å ææ¸ããè¨äºã®ãã®ã§ã)
- Remote Archive (tar.gz ã zip ã«ã¾ã¨ãããã®ã Git ãªã©ã«ç½®ãã¦ä½¿ã)
ããã§ã¯ã主㫠Git ã使ã£ãããã¸ã§ã¯ãã«ã¤ãã¦ç´¹ä»ãã¾ãã
ããã¸ã§ã¯ãã使ããã®
ããã¸ã§ã¯ãã¯ããã¤ãã®å ´é¢ã§ä½¿ããã¾ãã
ã¸ã§ããã³ãã¬ã¼ã
ããããã£ã¨ãä¸è¬çãªå©ç¨æ¹æ³ã§ããã¬ã¤ããã¯ãå®è¡ããããã®ãã®ã§ãããã¬ã¤ããã¯ã1ã¤ä»¥ä¸å«ãããã¸ã§ã¯ããé¸æããã¨ãPlaybook ã®ãã©ã¼ã ã®ãã«ãã¦ã³ããé¸æã§ããããã«ãªãã¾ãã
ã¯ã¼ã¯ããã¼ãã³ãã¬ã¼ã
ã¯ã¼ã¯ããã¼ãã³ãã¬ã¼ãã¯å¦çããã¼ãã¨ãã¦çµã¿åããã¦ã¯ã¼ã¯ããã¼ãä½ãæ©è½ã§ãã
ããã¸ã§ã¯ããåæãã¦ã¸ã§ããã³ãã¬ã¼ããå®è¡ããã¨ãããããªãã®ãä½ã£ã¦ã¿ã¾ãã¨ãã®ããã«ãªãã¾ãã
ãã ãããã¯ããä¾ã§ã¯ããã¾ãããæ®éã¯ãã®ãããªã¯ã¼ã¯ããã¼ãä½ããªãã¦ããããã¸ã§ã¯ãã«è¨å®ããããã¨ã§ãã¸ã§ããã³ãã¬ã¼ããå®è¡ããã¨ãã«ããã¸ã§ã¯ããæ´æ°ããããã¨ãã§ãã¾ããã¯ã¼ã¯ããã¼ã«ããã¨ãã¯ä¾ãã°éã«æ¿èªããã»ã¹ãæã¿ããå ´åããè¤æ°ã®ã¸ã§ããã³ãã¬ã¼ããçµã¿åããããå ´åãªã©ãèãããã¾ãã
ã¤ã³ãã³ããªã¼ã½ã¼ã¹
ããã¸ã§ã¯ãã¯ã¤ã³ãã³ããªã½ã¼ã¹ã¨ãã¦ã使ããã¨ãã§ãã¾ããã¤ã³ãã³ããªã¯ Ansible ãã¢ã¯ã»ã¹ããå¦ç対象ãè¨å®ãããã®ãªã®ã§ãããåçã«ã¯ã©ã¦ããµã¼ãã¹ãªã©ããæ¡ä»¶ãæå®ãã¦æ¥ç¶å ã®æ å ±ãåå¾ãããã¨ãã§ãã¾ãã
ãã¡ãã®ã¹ã¯ãªã¼ã³ã·ã§ããã®ããã«ãã¾ãã¾ãªãµã¼ãã¹ããã®åå¾ã«å¯¾å¿ãã¦ãã¾ãããããã¸ã§ã¯ãã®ä¸ã«ã¤ã³ãã³ããªã®è¨å®ãã¡ã¤ã«ãç½®ããã¨ã§ãç¬èªã«ã¤ã³ãã³ããªãã©ã°ã¤ã³ãå©ç¨ãã¦å¦ç対象ãåãåºãã¦ãããã¨ãã§ãã¾ããåã«ã¤ã³ãã³ããªæ å ±ã JSON ã INI ãã¡ã¤ã«ã§è¨è¿°ãããã®ã Git ã§ç®¡çãã¦ãé½åº¦æ´æ°ããªãã使ãã¨ãã使ãæ¹ãã§ãã¾ãã
ããã¸ã§ã¯ãã®è¨å®ã«ããéã
ã¸ã§ããã³ãã¬ã¼ããå®è¡ããã¨ãã«ã¯å¯¾å¿ããããã¸ã§ã¯ããã£ã¬ã¯ããªã /var/lib/awx/projects/ ãã£ã¬ã¯ããªã«ãã§ã«ãããã©ããã確èªããåå¾ãã¦ããªãã£ãã¨ãã«ã¯ Git ããåã£ã¦ããã¨ããåãããã¾ãã
ããã¸ã§ã¯ãã«ã¯ãªãã·ã§ã³ãããããã¨ããã¾ãã
ã¯ãªã¼ãã³ã°
æ®éã®ä½¿ãæ¹ã§ã¯ãããæèããå¿ è¦ã¯ãªãã®ã§ãããããã¸ã§ã¯ããã£ã¬ã¯ããªã« Controller ã®ãµã¼ãå ã§å¤æ´ãå ããå ´åã«ã¯ Git ã®å ã®ãªãã¸ããªã¨ç«¶åããå ´åãããã¾ãã®ã§ããã®ãªãã·ã§ã³ãæå¹ã«ãã¦ããã¨ãã¼ã«ã«ã®å¤æ´ãæ»ãã¦ããåæå¦çãé²ããããã«ãªãã¾ãã
åé¤
ããã¸ã§ã¯ããã£ã¬ã¯ããªãå®å ¨ã«åé¤ãã¦ããååº¦å ¨ä½ãåæãã¾ããä¾ãã°ãªãã¸ããªãåæ§æãã¦é£ç¶æ§ããªããªã£ãå ´åã«ã¯ãå±¥æ´æ å ±ã®ç®¡çãå´©ãã¾ãã®ã§ä¸æ¦å ¨é¨åé¤ãã¦ããããç´ããã¨ã«ãªãã¾ãã
ãµãã¢ã¸ã¥ã¼ã«ã追跡ãã
git submodule update --remote
ç¸å½ã®å¦çãå®è¡ãã¾ãã
èµ·åæã®ãªãã¸ã§ã³æ´æ°
ã¸ã§ããèµ·åããã¨ãã« git update
ãããã«ä»éããå¦çãå®è¡ãã¾ããæ¯åææ°ã®ãã¬ã¤ããã¯ã使ã£ã¦å¦çãå®è¡ãããã¨ãã«ã¯ãããæå¹ã«ãã¦ãããã¨ã§ãã¯ã¼ã¯ããã¼ãæ§æããªãã¦ãèªåçã«æ´æ°ãã¦ããã¸ã§ããå®è¡ãããã¨ãã§ãã¾ãã
ãã©ã³ãã®ä¸æ¸ã許å¯
ããã¸ã§ã¯ãå´ã§ã¯ã¾ã git clone
ãã¾ããããã®ãªãã·ã§ã³ãæå¹ã«ãã¦ããã¸ã§ã¯ããåæãã¾ãã¨ãã¸ã§ããã³ãã¬ã¼ãå´ã§ããã©ã³ããé¸æãã¦æå®ãããã¨ãã§ãã¾ãã
è¤æ°ã®ãã©ã³ãã管çãã Git ãªãã¸ããªããä¸ã¤ã®ããã¸ã§ã¯ãã¨ãã¦åæãã¦ãã¸ã§ããã³ãã¬ã¼ããè¤æ°ä½ã£ã¦ãããã使ãåãããã¨ãããããªå ´åã«å©ç¨ããã ãã¾ããæ¬çªç°å¢ã¨æ¤è¨¼ç°å¢ã§åããããªã©ãèãããã¾ãã
ããã¸ã§ã¯ãå¤ã® roles ã collections ã®å©ç¨
Git ã®ãªãã¸ããªã®ä¸ã« roles/requirements.yml ã collections/requirements.yml ãã¡ã¤ã«ãç½®ããã¨ã§ãããã¸ã§ã¯ãã®åææã« ansible-galaxy ã³ãã³ããå®è¡ãã¦ããã¸ã§ã¯ãã®å¤ãã roles ã collections ãåã£ã¦ããã¨ãããã¨ãã§ãã¾ããå ·ä½çã«ã¯ããããã®ã³ãã³ããããããå®è¡ãã¾ãã
$ ansible-galaxy role install -r roles/requirements.yml -p <project-specific cache location>/requirements_roles -vvv $ ansible-galaxy collection install -r requirements.yml -p <job tmp location>
ãã¡ãã®è¨äºãã覧ãã ããã
è¨å®
ãã¸ã§ãè¨å®ãã®ç»é¢ã«ã¯ãã®ããã¸ã§ã¯ãã«ã¤ãã¦ã®è¨å®ãããã¤ãããã¾ãã
Default Project Update Timeout
ããã¸ã§ã¯ãã®æ´æ°ã«ã¿ã¤ã ã¢ã¦ããè¨å®ãã¾ãã
Run Project Updates With Higher Verbosity
ããã¸ã§ã¯ãã®æ´æ°ã¸ã§ãã®çµæã詳細ã«åºåãã¾ããããã¸ã§ã¯ãã®æ´æ°ãå é¨çã«ã¯ãã¬ã¤ããã¯ãå®è¡ãã¦ãã¾ãã
ãã®ãã¬ã¤ããã¯ã¯ /var/lib/awx/venv/awx/lib/python3.8/site-packages/awx/playbooks/project_update.yml ã«ããã¾ãã®ã§ããããèå³ããã¾ãããã覧ãã ããã
Ignore Ansible Galaxy SSL Certificate Verification
Collections ãåã£ã¦ããå ã private Automation Hub ãªã©ã«è¨å®ããã¦ã㦠TLS/SSL ã®è¨¼ææ¸ãèªå·±ç½²åã«ãã¦ãããªã©ã®çç±ã§æ¤è¨¼ãã§ããªãå ´åã«ã¯ããã®ãªãã·ã§ã³ãæå¹ã«ãããã¨ã§è¨¼ææ¸ã®æ¤è¨¼ãããªãããã«ãããã¨ãã§ãã¾ãã
Enable Role Download
ãã®ãªãã·ã§ã³ããªãã«ãã¾ãã¨ãroles/requirements.yml ãããã¸ã§ã¯ãã«å«ã¾ãã¦ãã¦ãåãã«è¡ããªããªãã¾ãã
Enable Collection(s) Download
ä¸ã®ãªãã·ã§ã³ã¨åæ§ã«ããã®ãªãã·ã§ã³ããªãã«ãã¾ãã¨ãcollections/requirements.yml ãããã¸ã§ã¯ãã«å«ã¾ãã¦ãã¦ãåãã«è¡ããªããªãã¾ãã
Follow symlinks
ã¸ã§ããã³ãã¬ã¼ãã®è¨å®ã§ã¯ããã¸ã§ã¯ããããã¬ã¤ããã¯ãæ¤åºããå¦çãè¡ãã®ã§ããããã®ãªãã·ã§ã³ãæå¹ã«ãã¾ãã¨ãããã¸ã§ã¯ãã«å«ã¾ãã symlink ã追跡ãã¦ããããã«ãªãã¾ããééã£ãè¨å®ãå ¥ã£ã¦ããã¨ãã«ã¯ã«ã¼ããã¾ãã®ã§ãããã¯æå¹ã«ããªããã¨ããããããã¾ãã
ãããã«
Ansible Automation Platform ã® Controller (æ§ Tower) ã§ä½¿ãããããã¸ã§ã¯ãã«ã¤ãã¦ä¸éã解説ãã¾ããã
åççã«ã¯ãã¬ã¤ããã¯ä¸å¼ã Git ã§ç®¡çãã¦åã£ã¦ãã¦å®è¡ããã¨ãããã¨ã ãã§ã¯ããã®ã§ãããGit ã¨ã®é£æºã¯å©ç¨ç®çãéç¨æ¹æ³ã«å¿ãã¦ç´°ããå¶å¾¡ãããã¨ãã§ããã®ã§ããããã使ãæ¹ãæ¤è¨ããã ãã¾ãããã¨æãã¾ãã
ãã¬ã¤ããã¯ãæ´æ°ããã¨ãã«ã©ãããã¸ã§ã¯ãã«åæ ãã¦ããã®ãããã®ãã¨ãããã¨ããã話é¡ã«ãªãã¾ããããèµ·åæã®ãªãã¸ã§ã³æ´æ°ããæå¹ã«ãã¦ããã ãã¦ã¸ã§ããå®è¡ããã¨ãã®æ´æ°ã«ä»»ãããã¨ãã¾ãã¯åºæ¬çãªä½¿ãæ¹ã§ããä»ã®æ¹æ³ãé©ãã¦ããå ´åãããã¨æãã¾ãã®ã§ãããã§è§£èª¬ãããªãã·ã§ã³ãçµã¿åããããã¨ã§å®ç¾ã§ãããã©ãããããããã¨ãæ¤è¨ãã ããã
Ansible Automation Platform 㯠Developer Subscription ã§ãã試ãããã ãã¾ãã®ã§ããèå³æããã¾ããã試ãã¦ã¿ã¦ãã ããã
Happy Automation!