123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- ---
- - name: Create the directories for site specific configurations
- file: path={{nginx_conf_dir}}/{{ item }} state=directory owner=root group={{nginx_group}} mode=0755
- with_items:
- - "sites-available"
- - "sites-enabled"
- - "auth_basic"
- - "conf.d"
- tags: [configuration,nginx]
- - name: Ensure log directory exist
- file: path={{ nginx_log_dir }} state=directory owner={{nginx_user}} group={{nginx_group}} mode=0755
- tags: [configuration,nginx]
- - name: Copy the nginx configuration file
- template: src=nginx.conf.j2 dest={{nginx_conf_dir}}/nginx.conf
- notify:
- - restart nginx
- tags: [configuration,nginx]
- - name: Ensure auth_basic files created
- template: src=auth_basic.j2 dest={{nginx_conf_dir}}/auth_basic/{{ item }} owner=root group={{nginx_group}} mode=0750
- with_items: nginx_auth_basic_files.keys()
- tags: [configuration,nginx]
- - name: Create the configurations for sites
- template: src=site.conf.j2 dest={{nginx_conf_dir}}/sites-available/{{ item }}.conf
- with_items: nginx_sites.keys() | difference(nginx_remove_sites)
- notify:
- - restart nginx
- tags: [configuration,nginx]
- - name: Create links for sites-enabled
- file: state=link src={{nginx_conf_dir}}/sites-available/{{ item }}.conf dest={{nginx_conf_dir}}/sites-enabled/{{ item }}.conf
- with_items: nginx_sites.keys() | difference(nginx_remove_sites)
- notify:
- - reload nginx
- tags: [configuration,nginx]
- - name: Create the configurations for independent config file
- template: src=config.conf.j2 dest={{nginx_conf_dir}}/conf.d/{{ item }}.conf
- with_items: nginx_configs.keys()
- notify:
- - reload nginx
- tags: [configuration,nginx]
|