mirror of
https://github.com/HanXHX/ansible-nginx.git
synced 2026-02-24 09:03:29 +07:00
[WIP] FreeBSD install ok
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
- name: TEMPLATE | Deploy nginx.conf
|
||||
template: >
|
||||
src=etc/nginx/nginx.conf.j2
|
||||
dest=/etc/nginx/nginx.conf
|
||||
dest="{{ nginx_etc_dir }}/nginx.conf"
|
||||
notify: reload nginx
|
||||
|
||||
- name: TEMPLATE | Deploy all helpers
|
||||
@@ -16,6 +16,6 @@
|
||||
- name: TEMPLATE | Deploy custom http configuration
|
||||
template: >
|
||||
src=etc/nginx/conf.d/custom.conf.j2
|
||||
dest=/etc/nginx/conf.d/custom.conf
|
||||
dest="{{ nginx_etc_dir }}/conf.d/custom.conf"
|
||||
notify: reload nginx
|
||||
|
||||
|
||||
15
tasks/install_FreeBSD.yml
Normal file
15
tasks/install_FreeBSD.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
|
||||
- name: PKGNG | Install nginx and related tools
|
||||
pkgng: name=nginx state=present
|
||||
with_items:
|
||||
- nginx
|
||||
- py27-passlib
|
||||
- curl
|
||||
|
||||
- name: FILE | Create configuration dir (like Debian)
|
||||
file: path="{{ nginx_etc_dir }}/{{ item }}" state=directory
|
||||
with_items:
|
||||
- conf.d
|
||||
- sites-available
|
||||
- sites-enabled
|
||||
@@ -1,7 +1,11 @@
|
||||
---
|
||||
|
||||
|
||||
- name: INCLUDE_VARS | Related to OS
|
||||
include_vars: "{{ ansible_distribution }}.yml"
|
||||
|
||||
- name: INCLUDE | Install
|
||||
include: install.yml
|
||||
include: install_{{ ansible_distribution }}.yml
|
||||
|
||||
- name: INCLUDE | Prepare
|
||||
include: prepare.yml
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
---
|
||||
|
||||
- name: TEMPLATE | Deploy PHP upstream to Nginx
|
||||
template: src=etc/nginx/upstream/php.conf.j2 dest=/etc/nginx/conf.d/php.conf
|
||||
template: >
|
||||
src=etc/nginx/upstream/php.conf.j2
|
||||
dest="{{ nginx_etc_dir }}/conf.d/php.conf"
|
||||
when: nginx_php
|
||||
notify: reload nginx
|
||||
|
||||
- name: TEMPLATE | Deploy other upstreams
|
||||
template: src=etc/nginx/upstream/upstream.conf.j2 dest=/etc/nginx/conf.d/upstream-{{ item.name }}.conf
|
||||
template: >
|
||||
src=etc/nginx/upstream/upstream.conf.j2
|
||||
dest={{ nginx_etc_dir }}/conf.d/upstream-{{ item.name }}.conf
|
||||
with_items: "{{ nginx_upstreams }}"
|
||||
notify: reload nginx
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
file: >
|
||||
path={{ nginx_root }}/{{ item.name if item.name is string else item.name[0] }}/public
|
||||
state=directory
|
||||
owner={{ item.owner | default('www-data') }}
|
||||
group={{ item.group | default('www-data') }}
|
||||
owner={{ item.owner | default(nginx_user) }}
|
||||
group={{ item.group | default(nginx_user) }}
|
||||
mode={{ item.mode | default('0755') }}
|
||||
with_items: "{{ nginx_vhosts }}"
|
||||
when: >
|
||||
@@ -30,21 +30,21 @@
|
||||
- name: TEMPLATE | Create vhosts
|
||||
template: >
|
||||
src=etc/nginx/sites-available/{{ item.template if item.redirect_to is not defined else '_redirect' }}.j2
|
||||
dest=/etc/nginx/sites-available/{{ item.name if item.name is string else item.name[0] }}
|
||||
dest={{ nginx_etc_dir }}/sites-available/{{ item.name if item.name is string else item.name[0] }}
|
||||
with_items: "{{ nginx_vhosts }}"
|
||||
notify: reload nginx
|
||||
when: item.delete is not defined or not item.delete
|
||||
|
||||
- name: FILE | Delete vhosts
|
||||
file: path=/etc/nginx/sites-available/{{ item.name if item.name is string else item.name[0] }} state=absent
|
||||
file: path={{ nginx_etc_dir }}/sites-available/{{ item.name if item.name is string else item.name[0] }} state=absent
|
||||
with_items: "{{ nginx_vhosts }}"
|
||||
notify: reload nginx
|
||||
when: item.delete is defined and item.delete
|
||||
|
||||
- name: FILE | Enable vhosts
|
||||
file: >
|
||||
src=/etc/nginx/sites-available/{{ item.name if item.name is string else item.name[0] }}
|
||||
dest=/etc/nginx/sites-enabled/{{ item.name if item.name is string else item.name[0] }}
|
||||
src={{ nginx_etc_dir }}/sites-available/{{ item.name if item.name is string else item.name[0] }}
|
||||
dest={{ nginx_etc_dir }}/sites-enabled/{{ item.name if item.name is string else item.name[0] }}
|
||||
state=link
|
||||
with_items: "{{ nginx_vhosts }}"
|
||||
notify: reload nginx
|
||||
@@ -54,22 +54,22 @@
|
||||
(item.delete is not defined or not item.delete)
|
||||
|
||||
- name: FILE | Disable vhosts
|
||||
file: path=/etc/nginx/sites-enabled/{{ item.name if item.name is string else item.name[0] }} state=absent
|
||||
file: path={{ nginx_etc_dir}}/sites-enabled/{{ item.name if item.name is string else item.name[0] }} state=absent
|
||||
with_items: "{{ nginx_vhosts }}"
|
||||
notify: reload nginx
|
||||
when: (item.enable is defined and not item.enable) or (item.delete is defined and item.delete)
|
||||
|
||||
- name: FILE | Delete default vhost when explicitely defined
|
||||
file: >
|
||||
path=/etc/nginx/sites-enabled/default
|
||||
path={{ nginx_etc_dir }}/sites-enabled/default
|
||||
state=absent
|
||||
notify: reload nginx
|
||||
when: nginx_default_vhost is not none
|
||||
|
||||
- name: FILE | Auto set default vhost
|
||||
file: >
|
||||
src=/etc/nginx/sites-available/default
|
||||
dest=/etc/nginx/sites-enabled/default
|
||||
src={{ nginx_etc_dir }}/sites-available/default
|
||||
dest={{ nginx_etc_dir }}/sites-enabled/default
|
||||
state=link
|
||||
notify: reload nginx
|
||||
when: nginx_default_vhost is none
|
||||
|
||||
Reference in New Issue
Block a user