{"id":7488,"date":"2015-06-02T18:00:28","date_gmt":"2015-06-02T09:00:28","guid":{"rendered":"http:\/\/www.techscore.com\/blog\/?p=7488"},"modified":"2018-11-14T16:33:47","modified_gmt":"2018-11-14T07:33:47","slug":"ansible%e3%81%ae%e6%a8%99%e6%ba%96%e3%83%a2%e3%82%b8%e3%83%a5%e3%83%bc%e3%83%ab%e3%81%a7ec2%e3%81%ae%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e6%a7%8b%e7%af%89%e3%82%92%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.techscore.com\/blog\/2015\/06\/02\/ansible%e3%81%ae%e6%a8%99%e6%ba%96%e3%83%a2%e3%82%b8%e3%83%a5%e3%83%bc%e3%83%ab%e3%81%a7ec2%e3%81%ae%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e6%a7%8b%e7%af%89%e3%82%92%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b\/","title":{"rendered":"Ansible\u306e\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb\u3067EC2\u306e\u30b5\u30fc\u30d0\u30fc\u69cb\u7bc9\u3092\u3057\u3066\u307f\u308b"},"content":{"rendered":"<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p>\u306f\u3058\u3081\u307e\u3057\u3066\u3001\u591a\u7530\u3067\u3059\u3002<\/p>\n<p>\u6700\u8fd1\u306f\u74b0\u5883\u69cb\u7bc9\u306bAnsible\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u591a\u304f\u306a\u308a\u307e\u3057\u305f\u304c\u3001\u8abf\u3079\u3066\u3044\u308b\u3068AWS\u306e\u3088\u3046\u306a\u30af\u30e9\u30a6\u30c9\u74b0\u5883\u306e\u69cb\u7bc9\u306b\u3064\u3044\u3066\u3082Ansible\u306f\u305d\u306e\u591a\u304f\u3092\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u3057\u3066\u5099\u3048\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u306e\u3067\u3001\u3044\u304f\u3064\u304b\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<h2>\u3069\u3053\u307e\u3067\u3084\u308b\u304b<\/h2>\n<p>\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5229\u7528\u3057\u305fPlaybook\u3092\u4f5c\u6210\u3057\u3001\u4ee5\u4e0b\u306e\u5185\u5bb9\u306e\u69cb\u7bc9\u30fb\u8a2d\u5b9a\u3092\u884c\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<ul>\n<li>\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b0\u30eb\u30fc\u30d7\u306e\u4f5c\u6210<\/li>\n<li>EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u4f5c\u6210<\/li>\n<li>AMI\u306e\u4f5c\u6210<\/li>\n<li>CloudWatch\u306e\u8a2d\u5b9a\uff08\u30aa\u30fc\u30c8\u30ea\u30ab\u30d0\u30ea\uff09<\/li>\n<\/ul>\n<h2>\u524d\u63d0<\/h2>\n<ul>\n<li>AWS\u30de\u30cd\u30b8\u30e1\u30f3\u30c8\u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u3001\u30b5\u30fc\u30d0\u30fc\u69cb\u7bc9\u306b\u4f7f\u7528\u3059\u308bIAM\u30e6\u30fc\u30b6\u304c\u4f5c\u6210\u3055\u308c\u3066\u3044\u308b\u3053\u3068<\/li>\n<li>AWS\u30de\u30cd\u30b8\u30e1\u30f3\u30c8\u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u3001\u30ad\u30fc\u30da\u30a2\u3092\u767b\u9332\u3057\u3066\u3042\u308b\u3053\u3068<\/li>\n<\/ul>\n<h2>\u6e96\u5099<\/h2>\n<h3>Python\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p><a href=\"https:\/\/github.com\/yyuu\/pyenv\" target=\"_blank\">pyenv<\/a> \u3067python\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true \">\r\n[vagrant@ansible ~]$ sudo yum install git\r\n[vagrant@ansible ~]$ curl -L https:\/\/raw.githubusercontent.com\/yyuu\/pyenv-installer\/master\/bin\/pyenv-installer | bash\r\n[vagrant@ansible ~]$ echo 'export PATH=\"$HOME\/.pyenv\/bin:$PATH\"' >> ~\/.bashrc\r\n[vagrant@ansible ~]$ echo 'eval \"$(pyenv init -)\"' >> ~\/.bashrc\r\n[vagrant@ansible ~]$ echo 'eval \"$(pyenv virtualenv-init -)\"' >> ~\/.bashrc\r\n[vagrant@ansible ~]$ source ~\/.bashrc\r\n[vagrant@ansible ~]$ pyenv install 2.7.10\r\n[vagrant@ansible ~]$ pyenv rehash\r\n[vagrant@ansible ~]$ pyenv global 2.7.10\r\n[vagrant@ansible ~]$ python --version\r\nPython 2.7.10\r\n<\/pre>\n<h3>Ansible\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>pip\u3067Ansible\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true \">\r\n[vagrant@ansible ~]$ pip install ansible\r\n[vagrant@ansible ~]$ ansible --version\r\nansible 1.9.1\r\n<\/pre>\n<h3>boto\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>pip\u3067 <a href=\"https:\/\/github.com\/boto\/boto\" target=\"_blank\">boto<\/a> \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\uff08Ansible\u306eAWS\u95a2\u9023\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5229\u7528\u3059\u308b\u306e\u306b\u5fc5\u8981\uff09\u3002<\/p>\n<pre class=\"lang:sh decode:true \">\r\n[vagrant@ansible ~]$ pip install boto\r\n[vagrant@ansible ~]$ pip list | grep \"boto\"\r\nboto (2.38.0)\r\n<\/pre>\n<h3>API\u63a5\u7d9a\u60c5\u5831\u8a2d\u5b9a<\/h3>\n<p>IAM\u30e6\u30fc\u30b6\u4f5c\u6210\u6642\u306b\u8a2d\u5b9a\u3057\u305fAPI\u306e\u63a5\u7d9a\u60c5\u5831\u3092\u3001\u74b0\u5883\u5909\u6570\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true \">\r\n[vagrant@ansible ~]$ export AWS_ACCESS_KEY_ID=\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\r\n[vagrant@ansible ~]$ export AWS_SECRET_ACCESS_KEY=\u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\r\n[vagrant@ansible ~]$ env | grep \"AWS_\"\r\nAWS_ACCESS_KEY_ID=\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\r\nAWS_SECRET_ACCESS_KEY=\u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\r\n<\/pre>\n<h3>Dynamic Inventory\u30d5\u30a1\u30a4\u30eb\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/h3>\n<p>Ansible\u306e\u30ea\u30dd\u30b8\u30c8\u30ea\u304b\u3089<br \/>\n<a href=\"https:\/\/github.com\/ansible\/ansible\/blob\/stable-1.9\/plugins\/inventory\/ec2.ini\" target=\"_blank\">ec2.ini<\/a> \u3068<br \/>\n<a href=\"https:\/\/github.com\/ansible\/ansible\/blob\/stable-1.9\/plugins\/inventory\/ec2.py\" target=\"_blank\">ec2.py<\/a> \u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u304a\u304f\u3002<\/p>\n<h2>Playbook\u306e\u69cb\u6210<\/h2>\n<p>\u251c\u2500ansible-playbook<br \/>\n\u3000\u251c\u2500development.yml<br \/>\n\u3000\u251c\u2500hosts<br \/>\n\u3000\u2502\u3000\u2514\u2500development<br \/>\n\u3000\u2502\u3000\u3000\u2514\u2500ec2.ini\uff08\u6e96\u5099\u6bb5\u968e\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f ec2.ini \u3092\u8a2d\u7f6e\u3059\u308b\uff09<br \/>\n\u3000\u2502\u3000\u3000\u2514\u2500ec2.py\uff08\u6e96\u5099\u6bb5\u968e\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f ec2.py \u3092\u8a2d\u7f6e\u3059\u308b\u3002\u5b9f\u884c\u6a29\u9650\u3092\u4ed8\u4e0e\u3057\u3066\u304a\u304f\uff09<br \/>\n\u3000\u251c\u2500roles<br \/>\n\u3000\u2502\u3000\u251c\u2500ami<br \/>\n\u3000\u2502\u3000\u2502\u3000\u2514\u2500tasks<br \/>\n\u3000\u2502\u3000\u2502\u3000\u3000\u2514\u2500main.yml<br \/>\n\u3000\u2502\u3000\u251c\u2500cloud_watch<br \/>\n\u3000\u2502\u3000\u2502\u3000\u2514\u2500tasks<br \/>\n\u3000\u2502\u3000\u2502\u3000\u3000\u2514\u2500main.yml<br \/>\n\u3000\u2502\u3000\u251c\u2500ec2<br \/>\n\u3000\u2502\u3000\u2502\u3000\u2514\u2500tasks<br \/>\n\u3000\u2502\u3000\u2502\u3000\u3000\u2514\u2500main.yml<br \/>\n\u3000\u2502\u3000\u251c\u2500security_group<br \/>\n\u3000\u2502\u3000\u2502\u3000\u2514\u2500tasks<br \/>\n\u3000\u2502\u3000\u2502\u3000\u3000\u2514\u2500main.yml<\/p>\n<h2>Playbook\u306e\u4e2d\u8eab<\/h2>\n<h3>development.yml<\/h3>\n<p>master playbook\u3067\u3059\u3002<\/p>\n<pre class=\"lang:yaml decode:true \" >\r\n---\r\n- hosts: localhost\r\n  connection: local\r\n  gather_facts: no\r\n  roles:\r\n    - role: security_group\r\n    - role: ec2\r\n  vars:\r\n    ami_image: ami-cbf90ecb\r\n    key_name: ec2-key # AWS\u306b\u767b\u9332\u3057\u305f\u30ad\u30fc\u30da\u30a2\u540d\u3092\u5165\u529b\r\n    my_ip: xxx.xxx.xxx.xxx\/32 # \u30a2\u30af\u30bb\u30b9\u5143\u306eIP\u30a2\u30c9\u30ec\u30b9\r\n    group_name: \"development\"\r\n    instance_type: \"t2.micro\"\r\n    device_name: \"\/dev\/xvda\"\r\n    device_type: \"gp2\"\r\n    volume_size: 20 # EBS\u306e\u30c7\u30a3\u30b9\u30af\u30b5\u30a4\u30ba\uff08GB\uff09\r\n\r\n- hosts: tag_Name_development\r\n  remote_user: ec2-user\r\n  gather_facts: no\r\n  roles:\r\n    - role: ami\r\n    - role: cloud_watch\r\n<\/pre>\n<h3>roles\/security_group\/tasks\/main.yml<\/h3>\n<p><a href=\"http:\/\/docs.ansible.com\/ec2_group_module.html\" target=\"_blank\">ec2_group<\/a> \u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3063\u3066\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b0\u30eb\u30fc\u30d7\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\n\u30a4\u30f3\u30d0\u30a6\u30f3\u30c9\u306fssh\u306e\u307f\u3092\u8a31\u53ef\u3057\u3001\u30a2\u30a6\u30c8\u30d0\u30a6\u30f3\u30c9\u306f\u5168\u3066\u306e\u901a\u4fe1\u3092\u8a31\u53ef\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:yaml decode:true \" >\r\n---\r\n- name: \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b0\u30eb\u30fc\u30d7\u3092\u4f5c\u6210\r\n  ec2_group:\r\n    name: \"{{ group_name }}\"\r\n    description: \"{{ group_name }} server security group\"\r\n    region: ap-northeast-1\r\n    rules:\r\n      - proto: tcp\r\n        from_port: 22\r\n        to_port: 22\r\n        cidr_ip: \"{{ my_ip }}\"\r\n    rules_egress:\r\n      - proto: all\r\n        from_port: 0\r\n        to_port: 65535\r\n        cidr_ip: 0.0.0.0\/0\r\n\r\n<\/pre>\n<h3>roles\/ec2\/tasks\/main.yml<\/h3>\n<p><a href=\"http:\/\/docs.ansible.com\/ec2_module.html\" target=\"_blank\">ec2<\/a> \u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3063\u3066\u3001EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<br \/>\nEC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u306fdevelopment\u3068\u3044\u3046\u30bf\u30b0\u3092\u4ed8\u3051\u307e\u3059\u3002<\/p>\n<pre class=\"lang:yaml decode:true \" >\r\n---\r\n- name: EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u4f5c\u6210\r\n  ec2:\r\n    image: \"{{ ami_image }}\"\r\n    instance_type: \"{{ instance_type }}\"\r\n    region: ap-northeast-1\r\n    key_name: \"{{ key_name }}\"\r\n    group: \"{{ group_name }}\"\r\n    instance_tags:\r\n      Name: \"{{ group_name }}\"\r\n    wait: yes\r\n    wait_timeout: 300\r\n    volumes:\r\n      - device_name: \"{{ device_name }}\"\r\n        device_type: \"{{ device_type }}\"\r\n        volume_size: \"{{ volume_size }}\"\r\n        delete_on_termination: yes\r\n  register: ec2\r\n\r\n- name: SSH\u3067\u63a5\u7d9a\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u307e\u3067\u5f85\u6a5f\r\n  wait_for: port=22 host=\"{{ item.public_ip }}\" timeout=300 state=started\r\n  with_items: ec2.instances\r\n\r\n- name: \u4f5c\u6210\u3057\u305fEC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u30a4\u30f3\u30d9\u30f3\u30c8\u30ea\u306b\u8ffd\u52a0\r\n  add_host: hostname=\"{{ item.public_ip }}\" groupname=\"tag_Name_{{ group_name }}\"\r\n  with_items: ec2.instances\r\n<\/pre>\n<h3>roles\/ami\/tasks\/main.yml<\/h3>\n<p><a href=\"http:\/\/docs.ansible.com\/ec2_ami_module.html\" target=\"_blank\">ec2_ami<\/a> \u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3063\u3066\u3001AMI\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:yaml decode:true \" >\r\n---\r\n- name: EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u60c5\u5831\u3092\u53d6\u5f97\r\n  ec2_facts:\r\n\r\n- name: AMI\u3092\u4f5c\u6210\r\n  local_action:\r\n    module: ec2_ami\r\n    delete_snapshot: \"yes\"\r\n    description: \"{{ ansible_ec2_security_groups }} server AMI\"\r\n    instance_id: \"{{ ansible_ec2_instance_id }}\"\r\n    name: \"{{ ansible_ec2_security_groups }}\"\r\n    no_reboot: \"no\"\r\n    region: \"ap-northeast-1\"\r\n    state: \"present\"\r\n    wait: \"yes\"\r\n    wait_timeout: 600\r\n<\/pre>\n<h3>roles\/cloud_watch\/tasks\/main.yml<\/h3>\n<p><a href=\"http:\/\/docs.ansible.com\/ec2_metric_alarm_module.html\" target=\"_blank\">ec2_metric_alarm<\/a> \u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3063\u3066\u3001CloudWatch\u306e\u8a2d\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/aws.typepad.com\/aws_japan\/2015\/01\/new-auto-recovery-for-amazon-ec2.html\" target=\"_blank\">Amazon Web Services \u30d6\u30ed\u30b0<\/a>\u3092\u53c2\u8003\u306b\u3001\u30aa\u30fc\u30c8\u30ea\u30ab\u30d0\u30ea\u3092\u8a2d\u5b9a\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<pre class=\"lang:yaml decode:true \" >\r\n---\r\n- name: EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u60c5\u5831\u3092\u53d6\u5f97\r\n  ec2_facts:\r\n\r\n- name: \u30aa\u30fc\u30c8\u30ea\u30ab\u30d0\u30ea\u3092\u8a2d\u5b9a\r\n  local_action:\r\n    module: ec2_metric_alarm\r\n    alarm_actions: [\"arn:aws:automate:ap-northeast-1:ec2:recover\"]\r\n    comparison: \">=\"\r\n    description: \"Created from Ansible Playbook\"\r\n    dimensions: \"{'InstanceId':'{{ ansible_ec2_instance_id }}'}\"\r\n    evaluation_periods: 3\r\n    metric: \"StatusCheckFailed_System\"\r\n    name: \"awsec2-{{ ansible_ec2_instance_id }}-High-Status-Check-Failed-System-\"\r\n    namespace: \"AWS\/EC2\"\r\n    period: 60\r\n    region: \"ap-northeast-1\"\r\n    state: \"present\"\r\n    statistic: \"Minimum\"\r\n    threshold: 1.0\r\n<\/pre>\n<h2>Playbook\u306e\u5b9f\u884c<\/h2>\n<p>\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u3066Playbook\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u74b0\u5883\u69cb\u7bc9\u304c\u884c\u308f\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:sh decode:true \">\r\n[vagrant@ansible ~]$  ansible-playbook -i hosts\/development\/ec2.py development.yml --private-key=EC2\u306e\u79d8\u5bc6\u9375\r\n<\/pre>\n<h2>\u30dd\u30a4\u30f3\u30c8<\/h2>\n<p>role \u306e\u3046\u3061\u3001<br \/>\nami \u3068<br \/>\ncloud_watch<br \/>\n\u306e\u5b9f\u884c\u306b\u306f\u3001\u5bfe\u8c61EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9ID\u304c\u5fc5\u8981\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\n\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9ID\u306f\u3001<a href=\"http:\/\/docs.ansible.com\/ec2_facts_module.html\" target=\"_blank\">ec2_facts<\/a> \u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u53d6\u5f97\u3067\u304d\u307e\u3059\u304c\u3001\u305d\u306e\u524d\u306b\u5bfe\u8c61\u30db\u30b9\u30c8\u3092\u7279\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u5bfe\u8c61\u30db\u30b9\u30c8\u306eIP\u30a2\u30c9\u30ec\u30b9\u3092\u76f4\u63a5\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u304c\u3001Ansible\u306b\u306f <a href=\"http:\/\/docs.ansible.com\/intro_dynamic_inventory.html\" target=\"_blank\">dynamic_inventory<\/a> \u3068\u3044\u3046\u4ed5\u7d44\u307f\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u3053\u3061\u3089\u3092\u5229\u7528\u3057\u3066\u5bfe\u8c61\u30db\u30b9\u30c8\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\u5b09\u3057\u3044\u4e8b\u306b\u3001Ansible\u306b\u306fEC2\u7528\u306edynamic_inventory\u304c\u6a19\u6e96\u3067\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u203b\u6e96\u5099\u6bb5\u968e\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f<br \/>\n<a href=\"https:\/\/github.com\/ansible\/ansible\/blob\/stable-1.9\/plugins\/inventory\/ec2.ini\" target=\"_blank\">ec2.ini<\/a> \u3068<br \/>\n<a href=\"https:\/\/github.com\/ansible\/ansible\/blob\/stable-1.9\/plugins\/inventory\/ec2.py\" target=\"_blank\">ec2.py<\/a> \u3067\u3059\u3002<\/p>\n<p>development.yml\uff08master playbook\uff09 \u3067<br \/>\nhosts: tag_Name_development<br \/>\n\u3068\u3044\u3046\u5f62\u3067\u5bfe\u8c61\u30db\u30b9\u30c8\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u3053\u306e\u5834\u5408\u306f development \u3068\u3044\u3046\u30bf\u30b0\u3092\u4ed8\u3051\u305fEC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u5bfe\u8c61\u30db\u30b9\u30c8\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305fec2.py\u3092\u76f4\u63a5\u5b9f\u884c\u3057\u3066\u307f\u308b\u3068\u308f\u304b\u308a\u307e\u3059\u304c\u3001\u30bf\u30b0\u4ee5\u5916\u306b\u3082\u30ea\u30fc\u30b8\u30e7\u30f3\u3084\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30bf\u30a4\u30d7\u7b49\u3067\u5bfe\u8c61\u30db\u30b9\u30c8\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3082\u3067\u304d\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n<pre class=\"lang:yaml decode:true \" >\r\n{\r\n  \"_meta\": {\r\n    \"hostvars\": {\r\n      \"52.68.9.18\": {\r\n      }\r\n    }\r\n  },\r\n  \"ami-cbf90ecb\": [\r\n    \"52.68.9.18\"\r\n  ],\r\n  \"ap-northeast-1\": [\r\n    \"52.68.9.18\"\r\n  ],\r\n  \"ap-northeast-1a\": [\r\n    \"52.68.9.18\"\r\n  ],\r\n  \"ec2\": [\r\n    \"52.68.9.18\"\r\n  ],\r\n  \"i-d2d3f721\": [\r\n    \"52.68.9.18\"\r\n  ],\r\n  \"security_group_manage\": [\r\n    \"52.68.9.18\"\r\n  ],\r\n  \"tag_Name_manage\": [\r\n    \"52.68.9.18\"\r\n  ],\r\n  \"type_t2_micro\": [\r\n    \"52.68.9.18\"\r\n  ],\r\n  \"vpc_id_vpc-b04d44d2\": [\r\n    \"52.68.9.18\"\r\n  ]\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b<br \/>\n\u306f\u3058\u3081\u307e\u3057\u3066\u3001\u591a\u7530\u3067\u3059\u3002<\/p>\n<p>\u6700\u8fd1\u306f\u74b0\u5883\u69cb\u7bc9\u306bAnsible\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u591a\u304f\u306a\u308a\u307e\u3057\u305f\u304c\u3001\u8abf\u3079\u3066\u3044\u308b\u3068AWS\u306e\u3088\u3046\u306a\u30af\u30e9\u30a6\u30c9\u74b0\u5883\u306e\u69cb\u7bc9\u306b\u3064\u3044\u3066\u3082Ansible\u306f\u305d\u306e\u591a\u304f\u3092\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb\u3068\u3057\u3066\u5099\u3048\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u306e\u3067\u3001\u3044\u304f\u3064\u304b\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/><a href=\"https:\/\/www.techscore.com\/blog\/2015\/06\/02\/ansible%e3%81%ae%e6%a8%99%e6%ba%96%e3%83%a2%e3%82%b8%e3%83%a5%e3%83%bc%e3%83%ab%e3%81%a7ec2%e3%81%ae%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e6%a7%8b%e7%af%89%e3%82%92%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b\/\">\u7d9a\u304d\u3092\u8aad\u3080...<\/a><\/p>\n","protected":false},"author":42,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"tags":[201,119],"_links":{"self":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/7488"}],"collection":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/comments?post=7488"}],"version-history":[{"count":89,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/7488\/revisions"}],"predecessor-version":[{"id":7578,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/posts\/7488\/revisions\/7578"}],"wp:attachment":[{"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/media?parent=7488"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/categories?post=7488"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techscore.com\/blog\/wp-json\/wp\/v2\/tags?post=7488"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}