窝窝插件 发表于 2018-11-11 13:20:54

Configure webserver with nginx

- name: Configure webserver with nginx  
hosts: host1
  
become: yes
  
become_user: root
  
become_method: su
  
tasks:
  
    - name: install nginx
  
      yum: name=nginx
  
    - name: create sites-available directory
  
      file: path=/etc/nginx/sites-available state=directory mode=0755
  
    - name: copy nginx config file
  
      copy: src=files/nginx.conf dest=/etc/nginx/sites-available/default
  
    - name: create sites-enabled directory
  
      file: path=/etc/nginx/sites-enabled state=directory mode=0755
  
    - name: enable configuration
  
      file: >
  
      dest=/etc/nginx/sites-enabled/default
  
      src=/etc/nginx/sites-available/default
  
      state=link
  
    - name: copy index.html
  
      template: src=templates/index.html.j2 dest=/usr/share/nginx/html/index.html mode=0644
  
    - name: restart nginx
  
      service: name=nginx state=restarted


页: [1]
查看完整版本: Configure webserver with nginx