Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 649 Bytes

7_include.md

File metadata and controls

37 lines (26 loc) · 649 Bytes
  1. include

  • include 別のファイルを読む
$ cat site.yml

- hosts: all
  sudo: yes
  tasks:

  ~中略~

    - name: Install nginx
      yum: name=nginx state=latest

    - include: configure.yml

    - name: start nginx
      service: name=nginx state=started

  handlers:
    - name: restart nginx
      service: name=nginx state=restarted

$ cat configure.yml

- name: copy nginx.conf
  copy: src=nginx.conf dest=/etc/nginx/nginx.conf
  notify: restart nginx
  • yamlの構造に気をつける
    • 上のケースでは、includeされる側にはtasks: は不要

< 6. handlers || 8. vars >