ansible-nginx/tasks/prepare.yml

48 lines
1.0 KiB
YAML
Raw Normal View History

2016-01-12 00:20:42 +07:00
---
- name: SHELL | Get Nginx version
2021-09-01 16:58:39 +07:00
ansible.builtin.shell: nginx -v 2>&1 | sed -r 's#.*/##;' | cut -d ' ' -f 1
args:
executable: /bin/sh
register: nginx_version
changed_when: false
2021-09-01 16:21:12 +07:00
check_mode: false
tags:
- skip_ansible_lint
2016-01-12 21:10:43 +07:00
- name: SHELL | Get module list
2021-09-01 16:58:39 +07:00
ansible.builtin.shell: |
nginx -V 2>&1 |
tr -- - '\n' |
grep -A 1 with |
grep _module |
sed -r 's/_module//g; s/\s+//g' |
sort
args:
executable: /bin/sh
register: shell_modules
2016-01-12 21:10:43 +07:00
changed_when: false
2021-09-01 16:21:12 +07:00
check_mode: false
tags:
- skip_ansible_lint
2016-01-12 21:10:43 +07:00
- name: SET_FACT | Save modules
2021-09-01 16:58:39 +07:00
ansible.builtin.set_fact:
nginx_modules: "{{ shell_modules.stdout_lines }}"
2016-01-12 00:20:42 +07:00
- name: FILE | Create folders
2021-09-01 16:58:39 +07:00
ansible.builtin.file:
2017-07-27 17:21:10 +07:00
dest: "{{ item.dir }}"
owner: "{{ item.owner }}"
mode: "{{ item.mode }}"
state: directory
2019-02-05 03:25:25 +07:00
loop: "{{ nginx_dirs }}"
2016-01-12 00:20:42 +07:00
2016-11-29 20:32:27 +07:00
- name: FILE | Create ansible facts dir
2021-09-01 16:58:39 +07:00
ansible.builtin.file:
2017-07-27 17:21:10 +07:00
path: /etc/ansible/facts.d
state: directory
2021-09-01 16:45:44 +07:00
mode: 0755
owner: root
group: root