2016-03-05 21:07:39 +07:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: PKGNG | Install nginx and related tools
|
2022-11-25 15:52:40 +07:00
|
|
|
community.general.pkgng:
|
2017-10-03 22:57:35 +07:00
|
|
|
name: "{{ item }}"
|
|
|
|
state: present
|
2019-02-05 03:25:25 +07:00
|
|
|
loop:
|
2018-03-17 03:56:15 +07:00
|
|
|
- acme.sh
|
2016-03-07 18:08:34 +07:00
|
|
|
- "{{ nginx_pkgng_package }}"
|
2016-03-05 21:07:39 +07:00
|
|
|
- py27-passlib
|
|
|
|
- curl
|
|
|
|
|
2018-03-17 03:56:15 +07:00
|
|
|
#
|
|
|
|
# Bypass https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224166#c1
|
|
|
|
#
|
2022-11-25 15:52:40 +07:00
|
|
|
- name: Bypass https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224166#c1
|
|
|
|
when: true
|
|
|
|
block:
|
2018-03-17 03:56:15 +07:00
|
|
|
|
|
|
|
- name: COMMAND | Create /usr/local/etc/fdfs/http.conf
|
2021-09-01 16:58:39 +07:00
|
|
|
ansible.builtin.command: touch /usr/local/etc/fdfs/http.conf
|
2018-03-17 03:56:15 +07:00
|
|
|
args:
|
|
|
|
creates: /usr/local/etc/fdfs/http.conf
|
|
|
|
register: fd1
|
|
|
|
|
|
|
|
- name: LINEINFILE | Tune fdfs
|
2021-09-01 16:58:39 +07:00
|
|
|
ansible.builtin.lineinansible.builtin.file:
|
2018-03-17 03:56:15 +07:00
|
|
|
regexp: ^load_fdfs_parameters_from_tracker
|
|
|
|
line: load_fdfs_parameters_from_tracker=false
|
|
|
|
path: /usr/local/etc/fdfs/mod_fastdfs.conf
|
|
|
|
register: fd2
|
|
|
|
|
|
|
|
- name: SERVICE | Restart nginx when fdfs is tuned
|
2021-09-01 16:58:39 +07:00
|
|
|
ansible.builtin.service:
|
2018-03-17 03:56:15 +07:00
|
|
|
name: nginx
|
|
|
|
state: restarted
|
|
|
|
when: fd1.changed or fd2.changed
|
|
|
|
|
2016-03-05 21:07:39 +07:00
|
|
|
- name: FILE | Create configuration dir (like Debian)
|
2021-09-01 16:58:39 +07:00
|
|
|
ansible.builtin.file:
|
2017-10-03 22:57:35 +07:00
|
|
|
path: "{{ nginx_etc_dir }}/{{ item }}"
|
|
|
|
state: directory
|
2021-09-01 16:45:44 +07:00
|
|
|
mode: 0755
|
|
|
|
owner: root
|
|
|
|
group: root
|
2019-02-05 03:25:25 +07:00
|
|
|
loop:
|
2016-03-05 21:07:39 +07:00
|
|
|
- conf.d
|
|
|
|
- sites-available
|
|
|
|
- sites-enabled
|
2016-03-05 21:36:25 +07:00
|
|
|
|
2016-03-16 04:49:19 +07:00
|
|
|
- name: FILE | Create log directory
|
2021-09-01 16:58:39 +07:00
|
|
|
ansible.builtin.file:
|
2017-10-03 22:57:35 +07:00
|
|
|
path: "{{ nginx_log_dir }}"
|
|
|
|
owner: "{{ nginx_user }}"
|
|
|
|
group: wheel
|
|
|
|
mode: 0755
|
|
|
|
state: directory
|
2016-03-16 05:12:17 +07:00
|
|
|
|
|
|
|
- name: SERVICE | Enable nginx
|
2021-09-01 16:58:39 +07:00
|
|
|
ansible.builtin.service:
|
2017-10-03 22:57:35 +07:00
|
|
|
name: nginx
|
2021-09-01 16:21:12 +07:00
|
|
|
enabled: true
|