ã€ã³ãã©ã¹ãã©ã¯ãã£å ã®ãµãŒããŒã®æ°ã¯ãã§ã«800ãè¶ ããŠããŸããã1幎åã«ã¯çŽ500ã§ãã ã ããã«åãçµãããã«ã誰ããRed Hatã®ãœãªã¥ãŒã·ã§ã³ãç©æ¥µçã«äœ¿çšããŠããŸãã FreeIPAã«ã€ããŠ-LinuxãµãŒããŒã®ã¢ã¯ã»ã¹ãæŽçããã³ç®¡çããããã«-ãã§ã«æžããã®ã§ãæ§æ管çã®ãããã¯ã«è§ŠããããšæããŸãã ãããã®ç®çã®ããã«ãAnsibleã䜿çšããæè¿ã§ã¯AWXãè¿œå ãããŸãã-ãã¬ã€ããã¯ãããŒã³ãã¹ã±ãžã¥ãŒã«ãåšåº«ç®¡çããµãŒããŒã«ã¢ã¯ã»ã¹ããããã®è³æ Œæ å ±ãããã³ãµãŒããŒåŽã
å€ãã®ããšãåå ã§ãããã«çµ±åããŠã¡ã€ã³ã®War Robotsãããžã§ã¯ããšé£æºãããããšã¯ã§ããŸããã§ããããAWXããã§ãã¯ããããã®ãã£ãŒã«ãã¯ãããããããŸããã ãŸããå瀟ã¯éçº/ã¹ããŒãžç°å¢ããããŠãã¡ããæ¬çªç°å¢ãå°æ¥å¿ èŠãšããæ°ãããããžã§ã¯ããéçºããŠããŸãã ãããŠæè¿ãå éšåæã®ããã®ãããžã§ã¯ããããã«è¿œå ãããå®å šã«æ°ããã¯ã©ã¹ã¿ãŒãå¿ èŠã«ãªããŸããã
ããã§ã¯å§ããŸãããïŒ
AWXã¯2017幎9æã«å°å ¥ãããŸãã-ããã¯Apache-2.0ã©ã€ã»ã³ã¹ã®äžã§é åžãããç¡æã®ãªãŒãã³ãœãŒã¹ãããžã§ã¯ãã§ãããåçšãããžã§ã¯ãAnsible Towerã®ã¢ããã¹ããªãŒã ã§ãã äžè¬ã«ãããã¯ä»ã®Red Hatãããžã§ã¯ããšåãååã§ããRedHat Cloud Forms-ManageIQã RHEV-Ovirt; Red Hatèå¥ç®¡ç-FreeIPAãªã©ã
ãã®èšäºã¯ãAWXã®ã€ã³ã¹ããŒã«ããæåã®ãã¬ã€ããã¯ã®ç«ã¡äžããŸã§ã®ã¬ã€ãã§ãã ããããæåã«ãAWXã®äž»ãªæ©èœããªã¹ãããŸãããã
- ããŒãžã§ã³ç®¡çã·ã¹ãã ãšã®çµ±åïŒgit / mercurial / subversionïŒã
- ãã¬ã€ããã¯ã®ã¹ããŒã¿ã¹ããªã¢ã«ã¿ã€ã ã§è¿œè·¡ããŸãã
- ãã¬ã€ããã¯ã®èªåèµ·åã®ã¹ã±ãžã¥ãŒã«èšå®ã
- åäžã®ã¯ãŒã¯ãããŒã§è€æ°ã®ãã¬ã€ããã¯ãå®è¡ããŸãã
- ãã¬ã€ããã¯ãªãã®ã³ãã³ãã®ãªã¢ãŒãå®è¡ïŒAnsible ad hocïŒã
- ã³ãŒã«ããã¯ã¡ã«ããºã ã®ãµããŒããããã«ãããæ°ãããµãŒããŒãããããã®éšåã®æ§æãèŠæ±ã§ããŸãã
- ã¢ã³ãµã³ãã«ã®ã€ã³ãã³ããªç®¡çãAWS/ Azure / OpenStackãã©ãããã©ãŒã ãªã©ãšçµ±åããæ©èœããã€ãããã¯ã€ã³ãã³ããªãçæããããã®ãã€ãã£ãã¹ã¯ãªããã®ãµããŒããªã©ã
- ã¢ã¯ã»ã¹æš©ã®å·®å¥åã®æè»ãªã·ã¹ãã ã LDAP / SAML / Active Directoryãªã©ãšã®çµ±å
- é»åã¡ãŒã«/ Slack / PagerDuty / HipChat / MatterMost / IRCã®çµã¿èŸŒã¿éç¥ãµããŒãã
- å€éšãã°éçŽã·ã¹ãã ãšã®çµ±åïŒLogstash / Splunk / Loggly / Sumologicã
èšçœ®
çŸåšãããã€ãã®ã€ã³ã¹ããŒã«ãªãã·ã§ã³ããµããŒããããŠããŸãã
- Kubernetesã
- ãªãŒãã³ã·ããã
- Docker / Docker Composeã
ãããã¯ãã¹ãŠGitHubã®ããã¥ã¡ã³ãã§èª¬æãããŠããŸããããšãã°ãçŽç²ãªDockerã®ãªãã·ã§ã³ãæ€èšããŠãã ãããããã¯ãOpenShift / Kubernetesã®è¿œå æ§æãå¿ èŠãšããªãæéã®ãªãã·ã§ã³ã§ãã
Centos 7ã«ãã¹ãŠãã€ã³ã¹ããŒã«ããŸããDockerã®ã€ã³ã¹ããŒã«ã«ã€ããŠã¯å ¬åŒããã¥ã¡ã³ãã«ãèšèŒãããŠããããããã®èšäºã§ã¯è§ŠããŸããã
次ã«ãansibleãšdocker-pyã¢ãžã¥ãŒã«ãã€ã³ã¹ããŒã«ããå¿ èŠããããŸãã ããã¯ãpipããå®è¡ã§ããŸãã
pip install ansible pip install docker-py
AWXãªããžããªã®ã¯ããŒã³ãäœæããŸãã
git clone https://github.com/ansible/awx.git cd awx/installer
ã€ã³ãã³ããªãã¡ã€ã«ãç·šéããŸãã ãŸããå€æ°postgres_data_dirãä¿®æ£ããããšããå§ãããŸãã ããã©ã«ãã§ã¯ã/ tmp / pgdockerãšåãã§ããããã®ãŸãŸã«ããŠãããšããã°ãããããšAWXã䜿çšããpostgresqlããŒã¿ããŒã¹ã倱ãããå¯èœæ§ããããŸãã
å€éšããŒã¿ããŒã¹ã䜿çšããå Žåã¯ãå€æ°ãæå®ããŸãã
pg_hostname pg_username pg_password pg_database pg_port
ãã®åŸãå®è¡ããŸãïŒ
ansible-playbook -i inventory install.yml
ãã®ã³ãã³ãã¯ããã¬ã€ããã¯ãéå§ããç®çã®docker-imagesãããŒãããAWXãšè¿œå ã³ã³ããŒãã³ãïŒPostgresãMemCachedãRabbitMQïŒã§ã³ã³ãããçŽæ¥èµ·åããŸãã
ãã¬ã€ããã¯ãå®äºãããšã次ã®ã³ã³ããã衚瀺ãããŸãã
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b1bd94f83420 ansible/awx_task:latest "/tini -- /bin/sh ..." 6 days ago Up 6 days 8052/tcp awx_task abf30fd81335 ansible/awx_web:latest "/tini -- /bin/sh ..." 6 days ago Up 6 days 0.0.0.0:80->8052/tcp awx_web b13ee3c7cbb7 memcached:alpine "docker-entrypoint..." 2 months ago Up 6 days 11211/tcp memcached 3c4cac5a4ce5 rabbitmq:3 "docker-entrypoint..." 2 months ago Up 6 days 4369/tcp, 5671-5672/tcp, 25672/tcp rabbitmq b717c6019e02 postgres:9.6 "docker-entrypoint..." 2 months ago Up 6 days 5432/tcp postgres
次ã®ããã«AWXã€ã³ã¹ããŒã«ããã»ã¹ã«åŸããŸãã
docker logs -f awx_task
AWXã¯ãããŒã80ã®ãµãŒããŒã¢ãã¬ã¹ã§å©çšã§ããŸãïŒã€ã³ãã³ããªãã¡ã€ã«ã§ããŒããå€æŽããŠããªãå ŽåïŒã
ããã©ã«ãã®ãŠãŒã¶ãŒåãšãã¹ã¯ãŒãïŒ
Admin:password
䜿çšæ³ãšäŸ
次ã«ãAWXã«çŽæ¥ã¢ã¯ã»ã¹ããŸãããæåã«ãã¹ãŠãã©ã®ããã«æ§æãããŠããããèŠãŠãããŸãã
ãŸãããããžã§ã¯ãã®ã»ã¯ã·ã§ã³ã«èå³ããããŸãã AWXçšèªã®ãããžã§ã¯ããšã¯ãAWXãµãŒããŒãŸãã¯ãªããžããªã«ããŒã«ã«ã«é 眮ãããäžé£ã®ãã¬ã€ããã¯ãæå³ããŸãã
æåã®ãããžã§ã¯ããäœæããŸãã
-ååïŒãããžã§ã¯ãã®ååãfirstprojectã«ããŸãã
-çµç¹ïŒAWXã§ã¯ãããã¯ã¢ã¯ã»ã¹ã®å¶åŸ¡ã«äœ¿çšããããšã³ãã£ãã£ã§ãã çµç¹ã«ã¯ãã€ã³ãã³ããªããŠãŒã¶ãŒããŠãŒã¶ãŒã°ã«ãŒãããã¬ã€ããã¯ãå«ãŸããå ŽåããããŸãã ããã©ã«ããéžæããŸãã
-SCM TYPEïŒãªããžããªã¿ã€ããããŒã«ã«ãã£ã¬ã¯ããªãŸãã¯ããŒãžã§ã³ç®¡çã·ã¹ãã ã®ãããããéžæã§ããŸãïŒgitãmercurialãsubversionã
-SCM UrlïŒãªããžããªã®URLã
-SCMãã©ã³ã/ã¿ã°/ã³ãããïŒãªãã·ã§ã³ã§ãå¿ èŠãªãã©ã³ã/ã¿ã°/ã³ããããæå®ã§ããŸãã
-[SCMè³æ Œæ å ±]ãã£ãŒã«ãã§ããªããžããªãžã®ã¢ã¯ã»ã¹ã«äœ¿çšããã詳现ãéžæã§ããŸãã
ãã§ãã¯ããã¯ã¹ããªãã«ããããšãã§ããŸãïŒ
-ã¯ãªãŒã³ïŒæŽæ°ããåã«ãã¹ãŠã®ããŒã«ã«å€æŽãåé€ããŸãã
-æŽæ°æã«åé€ïŒãããžã§ã¯ããæŽæ°ãããšãã«ãããŒã«ã«ã³ããŒãåé€ãããªããžããªã®æ°ããã³ããŒãåèªã¿èŸŒã¿ããŸãã
-èµ·åæã«æŽæ°ïŒãã®ãããžã§ã¯ããããã¬ã€ããã¯ãéå§ãããã³ã«ããªããžããªã®ããŒã«ã«ã³ããŒãçŸåšã®ããŒãžã§ã³ã«æŽæ°ããŸãã æŽæ°æã«åé€ãšçµã¿åãããŠäœ¿çšââã§ããŸããããªããžããªãšã®åæã®çµäºãåŸ ã€å¿ èŠãããããããã¬ã€ããã¯ã®å®è¡æéãé·ããªãå¯èœæ§ããããŸãã
èµ·åæã«ã¯ãªãŒã³ã¢ãããšæŽæ°ãéžæããŸãã [ä¿å]ãã¯ãªãã¯ãããã®åŸãæåã®ãããžã§ã¯ãã®äœæãå®äºããŸãã
[ãããžã§ã¯ã]ã»ã¯ã·ã§ã³ã«ç§»åããŠããããžã§ã¯ãã®[scmæŽæ°ã®éå§]ãã¿ã³ãã¯ãªãã¯ããŸãã ãªããžããªã®æåã®ããŠã³ããŒããå®äºãããŸã§åŸ æ©ããŸãïŒæŽæ°ã®ã¹ããŒã¿ã¹ã¯[ãžã§ã]ã»ã¯ã·ã§ã³ã§ç£èŠã§ããŸãïŒã
ãªããžããªã«ãããã¬ã€ããã¯ãèŠãŠã¿ãŸãããã Habréã«ã¯Ansibleãšãã®ãã¬ã€ããã¯/ããŒã«ã®æ§é ã«ã€ããŠèª¬æããèšäºããããããããŸãã®ã§ããã®ç¹ã«ã€ããŠã¯è©³ãã説æããŸããïŒããšãã°ã 1ã2ã3ã®èšäºããããŸãïŒã
firstproject/ âââ ansible.cfg âââ group_vars/ âââ host_vars/ âââ roles/ â âââ requirements.yml âââ run.yml
AWXã¯ãfirstprojectãã£ã¬ã¯ããªã®ã«ãŒãã«ãã.ymlãã¡ã€ã«ããã¬ã€ããã¯ãšããŠæ±ããŸãã
run.ymlãã¡ã€ã«ã®å 容ïŒ
--- - name: Test Role hosts: - all gather_facts: true roles: - roleawx
ã€ãŸããäºå®ãåéããåŸãåã«roleawxãå®è¡ããŸãã AWXèªäœã§ãã¹ããšã°ã«ãŒããã¹ããæå®ã§ããããããã¹ãŠãæå®ãããã¹ãã
èå³æ·±ãç¹ã¯ãroles / requirements.ymlãã¡ã€ã«ã®å 容ã§ãïŒ
- src: git@gitlab.example.com:ansible-roles/roleawx.git scm: git
ProjectãåæãããšããAWXã¯ãrequirements.ymlãã¡ã€ã«ã«åŸã£ãŠãã¹ãŠã®ããŒã«ãããŒã«ãã£ã¬ã¯ããªã«ã€ã³ã¹ããŒã«ããŸãã ãã®å ŽåãgitãªããžããªããroleawxããŒã«ãã€ã³ã¹ããŒã«ããŸãã
次ã®ã³ãã³ãã䜿çšããŠããŒã«ãäœæããŸãã
ansible-galaxy init roleawx
ããŒã«ã®æ§é ã¯æ¬¡ã®ãšããã§ãã
roleawx/ âââ README.md âââ defaults â âââ main.yml âââ files âââ handlers â âââ main.yml âââ meta â âââ main.yml âââ tasks â âââ main.yml âââ templates âââ tests â âââ inventory â âââ test.yml âââ vars âââ main.yml
tasks / main.ymlãã¡ã€ã«ã®å 容ïŒ
--- # tasks file for roleawx - name: Test Message debug: msg: "AWX and Ansible"
éå§ããã«ã¯ããAWX and Ansibleããšããã¡ãã»ãŒãžã衚瀺ããã ãã§ãã
requirements.ymlãã¡ã€ã«ã§æå®ãããããŒã«ãAWXãèªåçã«ã€ã³ã¹ããŒã«ããããã«ã¯ãããŒã«èªäœã§meta / main.ymlãã¡ã€ã«ãæ£ããçæãããå¿ èŠãããããšã«æ³šæããŠãã ããïŒansible-galaxy initã䜿çšããŠããŒã«ã®ãã³ãã¬ãŒããäœæãã次ã«meta / main .ymlã¯åé¡ãªããAWXã¯ãã®ããŒã«ãããŒãã§ããŸãïŒã
ãããã£ãŠããã¬ã€ããã¯ã®ãããªããžããªãšãããŒã«ã®ãããªããžããªããããŸãã ãŸãã192.168.10.233ã192.168.10.234ãããã³192.168.10.239ã®ã¢ãã¬ã¹ãæã€è€æ°ã®ä»®æ³ãã·ã³ããããŸãã
ãã¬ã€ããã¯ãéå§ããåã«ãAnsibleãAWXãµãŒããŒãããã¹ãã«å°éã§ããããšã確èªããå¿ èŠããããŸãïŒãã®å ŽåãSSHçµç±ïŒã ãã¬ã€ããã¯å ã®å€æ°ã§çŽæ¥ãã¹ã¯ãŒããæå®ã§ããŸãããããã¯é¢çœããããŸããã AWXã¯ãµãŒããŒã«ã¢ã¯ã»ã¹ããããã®è©³çŽ°ã管çã§ããŸããããã䜿çšããŸãã
[è³æ Œæ å ±]ã¿ãã«ç§»åãã[è¿œå ]ãã¿ã³ãã¯ãªãã¯ããŸãã
-ååïŒè©³çŽ°ã«ååãä»ããŸãã
-è³æ Œæ å ±ã¿ã€ãïŒããã§ã詳现ã®ã¿ã€ããéžæã§ããŸãã ãã·ã³ã䜿çšããŠãµãŒããŒã«ã¢ã¯ã»ã¹ããããšã«èå³ããããŸãã ããã«ãAWXã¯ãscmïŒgitãsvnãmercurialïŒãRed Hat InsightãAWSãAzureãRed Hat SatelliteãRHEVãVmwareãOpenStackãªã©ã®ããŸããŸãªãµãŒãã¹ãšçµ±åããããã«äœ¿çšã§ããããŸããŸãªçš®é¡ã®ã¢ã¯ã»ã¹è©³çŽ°ãæäŸããŸãã ç¬èªã®çš®é¡ã®è³æ Œæ å ±ãäœæããããšãã§ããŸãã
-ãŠãŒã¶ãŒåïŒã«ãŒããéžæããŸãã
-ãã¹ã¯ãŒãïŒããŒã¢ã¯ã»ã¹ã䜿çšããããã空çœã®ãŸãŸã«ããŸãã
-ãã©ã€ããŒãããŒãã¹ãã¬ãŒãºïŒããŒããã¹ã¯ãŒãã§äœæãããŠããå ŽåãããŒã®ãã¹ã¯ãŒãã ãã®å ŽåãããŒã«ã¯ãã¹ã¯ãŒããå«ãŸããŠããªãããããã£ãŒã«ãã¯ç©ºçœã®ãŸãŸã«ããŸãã
-ç¹æš©ãšã¹ã«ã¬ãŒã·ã§ã³æ¹æ³ïŒç¹æš©ãšã¹ã«ã¬ãŒã·ã§ã³æ¹æ³ã äŸïŒsudoãsuãpfexecãªã©ã
-PRIVILEGE ESCALATION USERNAMEïŒAnsibleãç¹æš©ãåãåããŠãŒã¶ãŒã
-ç¹æš©ãšã¹ã«ã¬ãŒã·ã§ã³ãã¹ã¯ãŒãïŒç¹æš©ãšã¹ã«ã¬ãŒã·ã§ã³çšã®ãã¹ã¯ãŒãã
ã«ãŒããšããŠãã°ã€ã³ãããããæš©éææ Œã«é¢é£ãããã£ãŒã«ãã¯ç©ºã®ãŸãŸã«ããŸãã
泚ïŒããã€ãã®ãã£ãŒã«ãã«ã¯[èµ·åæã«ããã³ãââãã衚瀺ãã]ãã§ãã¯ããã¯ã¹ããããŸãã ãã®ãã§ãã¯ããã¯ã¹ãæå¹ã«ãããšã察å¿ãããã£ãŒã«ããæäŸããããã¬ã€ããã¯ãéå§ããããã³ã«æåã§å ¥åããããããã®è©³çŽ°ãé¢é£ä»ããããŸãã ãããã£ãŠãAWXå ã«ãã¹ã¯ãŒããä¿åããããšã¯ã§ããŸãããããã¬ã€ããã¯ãéå§ãããã³ã«ãã¹ã¯ãŒããèŠæ±ã§ããŸãã
ãã®ããããµãŒããŒã«ã¢ã¯ã»ã¹ããããã®ãããžã§ã¯ããšè©³çŽ°ãäœæããŸããã 次ã«ãã€ã³ãã³ããªãå¿ èŠã§ãã
[ã€ã³ãã³ããª]ã»ã¯ã·ã§ã³ã«ç§»åãã[è¿œå ]ãã¿ã³ãã¯ãªãã¯ããŸãã 以äžãäœæããããã®éžæè¢ãæäŸãããŸãã
-ã€ã³ãã³ããªïŒéåžžã®ã€ã³ãã³ããªã
-ã¹ããŒãã€ã³ãã³ããªïŒæ¢åã®ãã¹ãã«åºã¥ããŠãããšãã°ãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®ã¿ã€ããªã©ã®ãã©ã¡ãŒã¿ã«åºã¥ããŠãã€ã³ãã³ããªãçæã§ããŸãã
éåžžã®ã€ã³ãã³ããªãäœæããŸãã
-[åå]ãã£ãŒã«ãã§ãååãæå®ããŸãã
-ããã©ã«ãã®çµç¹ãéžæããŸãã
-[å€æ°]ãã£ãŒã«ãã§ãåŸã§ãã¬ã€ããã¯ãã䜿çšã§ããå€æ°ãæå®ã§ããŸãã
次ã®ããšã瀺ããŠããŸãïŒ
--- awxinvvar: "Test"
ã€ã³ãã³ããªãä¿åãããŸã§ãæ®ãã®ã¿ãã¯éã¢ã¯ãã£ãã§ãã
ä¿åããŠãã€ã³ãã³ããªã»ã¯ã·ã§ã³ã«æ»ããŸãã ã€ã³ãã³ããªããªã¹ãã«è¡šç€ºãããŸããã ããã«è¡ããŸãããïŒäžéšã¿ããäœæããåŸãã¢ã¯ãã£ãã«ãªããŸããã
-æš©éïŒããã¯ãã©ã®ãŠãŒã¶ãŒãŸãã¯ãŠãŒã¶ãŒã°ã«ãŒããã€ã³ãã³ããªã«ã¢ã¯ã»ã¹ã§ããããå¶åŸ¡ããŸãã
-ã°ã«ãŒãïŒãã¹ãã°ã«ãŒãã®ãªã¹ãã
-ãã¹ãïŒãã¹ãã®ãªã¹ãã
-ãœãŒã¹ïŒã€ã³ãã³ããªã®ãœãŒã¹ã®ãªã¹ãã AWS / Azure / OpenStack / RHEVããã³å€æ°ã®ãµãŒãã¹ããã€ã³ãã³ããªãã¢ã³ããŒãã§ããŸãããããžã§ã¯ãå ã«ããã€ã³ãã³ããªãã¡ã€ã«ãæå®ããããšããDynamic InventoryããœãŒã¹ãšããŠçæããç¬èªã®ã¹ã¯ãªãããæå®ããããšãã§ããŸãã
-å®äºãããžã§ãïŒçŸåšã®ã€ã³ãã³ããªã®ãã¹ãã«é¢é£ä»ããããå®è¡äžã®ãã¬ã€ããã¯ã®ãªã¹ãã
ãã¹ããã»ãšãã©ããªããããã€ã³ãã³ããªãæã§åããŸãã [ãã¹ã]ã¿ãã«ç§»åããŠãããã€ãã®ãã¹ããäœæããŸãã
-[ãã¹ãå]ãã£ãŒã«ãã§ããµãŒããŒã®IPã¢ãã¬ã¹ãŸãã¯ãã®DNSåãæå®ã§ããŸãã
-[å€æ°]ãã£ãŒã«ãã§ããã¹ãã®1ã€ã«å¯ŸããŠawxinvvarå€æ°ããªãŒããŒã©ã€ãããŠã¿ãŸãã
--- awxinvvar: "Host1"
ãã¹ããäœæãããã[ã°ã«ãŒã]ã¿ãã«ç§»åããŠããã¹ãã®ã°ã«ãŒããäœæããŸãã
åæ§ã«ãã°ã«ãŒãåãæå®ããããããã®ã°ã«ãŒãã®awxinvvarå€æ°ãåå®çŸ©ããŸãã
[ãã¹ã]ã¿ãã«æ»ãããªã¹ããããã¹ãã®1ã€ãéžæãããã®ãã¹ãã®[ã°ã«ãŒã]ã¿ãã«ç§»åããŠã[ã°ã«ãŒãã®é¢é£ä»ã]ãã¯ãªãã¯ããŸãã
ãã¹ãã®çµç©é ã§ã¯ãåãã¹ããã©ã®ã°ã«ãŒãã§æ§æãããŠãããã確èªã§ããŸãã
ãšããã§ã[å®è¡]ã³ãã³ããã¿ã³ã¯ã[ãã¹ã]ã¿ããš[ã°ã«ãŒã]ã¿ãã§ã䜿çšã§ããŸãã ããã¯ããã¬ã€ããã¯ãªãã§ãªã¢ãŒããã¹ãã§ã¢ã¯ã·ã§ã³ãå®è¡ã§ããAnsibleã®ã¢ãããã¯ã³ãã³ãã«é¡äŒŒããŠããŸã ã
ãã£ãŠã¿ãŸãããã ãªã¹ããããã¹ããéžæããåã«äœæããSSHã¢ã¯ã»ã¹ã®ããŒãéžæããã·ã§ã«ã¢ãžã¥ãŒã«ã䜿çšããŠdateã³ãã³ããå®è¡ããŸãã
èµ·åãã¯ãªãã¯ããŸãã é²è¡ç¶æ³ããªã¢ã«ã¿ã€ã ã§ç£èŠã§ããããŒãžã«ç§»åããå¿ èŠããããŸãã ãŸãããã¬ã€ããã¯/ã¢ãããã¯ã³ãã³ãã®ãã¹ãŠã®èµ·åã¯ããžã§ãã»ã¯ã·ã§ã³ã«è¡šç€ºãããŸãã
ã¢ãããã¯ããŒã ã¯æ£åžžã«å®äºããŸããã
ããã§ã¯ããã¬ã€ããã¯ãèµ·åããŠã¿ãŸãããã [ãã³ãã¬ãŒã]ã»ã¯ã·ã§ã³ã«ç§»åãã[è¿œå ]ãã¿ã³ãã¯ãªãã¯ããŠã[ãžã§ããã³ãã¬ãŒã]ãéžæããŸãã
çšèªã§ã¯ãAWXãã³ãã¬ãŒãã¯ããã¬ã€ããã¯ãèµ·åããããã«äœ¿çšããããã©ã¡ãŒã¿ãŒã®ã»ããã§ãã æå°éã®ãã©ãŒã ã§ã¯ããã³ãã¬ãŒãã®ååãæå®ãããããžã§ã¯ããéžæãããã¬ã€ããã¯ãéžæããã€ã³ãã³ããªãéžæããå¿ èŠããããŸãã
ãã³ãã¬ãŒãã®äœæã¯æ¬¡ã®ããã«ãªããŸãã
-ååãšèª¬æïŒãã³ãã¬ãŒãã®ååãšèª¬æã
-ãžã§ãã®çš®é¡ïŒå®è¡ãŸãã¯ç¢ºèªã ã€ãŸãããã¬ã€ããã¯ãéå§ããããå€æŽãå ããã«ãã¬ã€ããã¯ããã§ãã¯ããïŒãã©ã€ã©ã³ïŒã ãã§ãã
-ã€ã³ãã³ããªïŒãã¬ã€ããã¯ãèµ·åãããã€ã³ãã³ããªã
-ãããžã§ã¯ããšãã¬ã€ããã¯ïŒãã¬ã€ããã¯ãšãããžã§ã¯ãããç¹å®ã®ãã¬ã€ããã¯ãå«ããããžã§ã¯ããéžæããããã«èšèšãããŠããŸãã
-å¶éïŒãã¬ã€ããã¯ãèµ·åããããã¹ããšã°ã«ãŒãã®ãªã¹ãã
-åé·æ§ïŒAnsibleãå®è¡çµæãã©ã®çšåºŠè©³çŽ°ã«åºåãããïŒ-v -vv -vvvã¹ã€ããã®ã¢ããã°ïŒã
-ãžã§ãã¿ã°ïŒã¿ã°ã®ãªã¹ã-éå§ããå¿ èŠã®ããã¿ã¹ã¯ã æå®ããªãå ŽåãããŒã«ã«èšè¿°ãããŠãããã¹ãŠã®ã¿ã¹ã¯ãå®è¡ãããŸãã
-ã¿ã°ãã¹ãããïŒã¿ã°ã®ãªã¹ã-å®è¡ãããªãã¿ã¹ã¯ã
-ã©ãã«ïŒãã®ãã³ãã¬ãŒãã«é¢é£ä»ããããã©ãã«ã AWXèªäœã®ãã£ã«ã¿ãªã³ã°ã«äœ¿çšã§ããŸãã
-å·®åã®è¡šç€ºïŒAnsibleã«ããå€æŽã衚瀺ããŸãïŒ--diffããŒã®ã¢ããã°ïŒã
ãããžã§ã¯ããä¿åãããã³ãã¬ãŒãã»ã¯ã·ã§ã³ã«æ»ã£ãŠããã¬ã€ããã¯ïŒãã±ããã®åœ¢ã®ãã¿ã³ïŒãèµ·åããŸãã
äžæ³ãç§ãã¡ã®ãã¬ã€ããã¯ãéå§ãããå¿ èŠãªåœ¹å²ãããŠã³ããŒãããŠæ£åžžã«å®äºããŸããã ã¡ãªã¿ã«ãåãããŒãžã§ããã¬ã€ããã¯ã®çµæãããŠã³ããŒãã§ããŸãã ãã¬ã€ããã¯ã®åºåãæ€çŽ¢ããããšãã§ããŸãã
ããã€ãã®å Žæã«awxinvvarå€æ°ãè¿œå ããããšãèŠããŠããŸããïŒ åœŒå¥³ãé£ããŠããŠãäœãèµ·ãããèŠãŠã¿ãŸãããã
tasks / main.ymlãã¡ã€ã«ã®ããŒã«ã«æ¬¡ãè¿œå ããŸãã
- name: Print var debug: msg: "{{ awxinvvar }}"
ãããŠããã³ãã¬ãŒããå床å®è¡ããŸãã
ãã¬ã€ããã¯ã¯ãInventoryã§å®çŸ©ããå€æ°ãåç §ããå€æ°ã®äœ¿çšã®åªå é äœã«åŸã£ãŠæ£ããåå®çŸ©ããŸã ã
ãšããã§ãå€æ°ã¯ãå¿ èŠã«å¿ããŠhost_vars group_varsãã£ã¬ã¯ããªã®ãªããžããªã«ä¿åããããšãã§ããŸãã ãã ãããã®å ŽåãAWXèªäœã®ã€ã³ãã³ããªã«ã¯è¡šç€ºãããŸããã
çµè«ã®ä»£ããã«
çŸåšãAWXãæ°ãæ䜿çšããŠããããããŸã§ã®ãšãããã¹ãŠã«æºè¶³ããŠããŸãã ãã¡ãããããã¯æ°ãããããžã§ã¯ãã§ãããããããŸããŸãªçš®é¡ã®åé¡ïŒäž»ã«ã€ã³ã¿ãŒãã§ã€ã¹ã®å°ããªãã°ïŒã«å®æçã«ééããŸããããããã¯é倧ã§ã¯ãªããäœæ¥ã«å¹²æžããŸããã
泚ïŒæ°ãããªãªãŒã¹ã¯çŸåšé »ç¹ã«ãªãªãŒã¹ãããŠãããæŽæ°ã«åé¡ãããå¯èœæ§ããããŸãã ããã¯ã¢ãããäœæããŠãã ããïŒ
ãã®ããã¥ã¢ã«ã¯ãAWXã®åºæ¬æ©èœãç解ããããã«æžããããã®ã§ãããèå³æ·±ãå Žåã¯ãåçã€ã³ãã³ããªãã³ãŒã«ããã¯ãªã©ã®ãœãŒã¹ãšã®çµ±åãªã©ãè¿œå ã®æçšãªæ©èœã«ã€ããŠèšè¿°ããŸãã
PSãšããã§ãããã§ã¯ãã€ã³ãã©ã¹ãã©ã¯ãã£ã®äžéšã«äœ¿çšããAWXããã·ã¥ããŒãã®ããã«èŠããŸãã