ansible-nginx/tasks/prepare.yml

44 lines
1.2 KiB
YAML

---
- name: SET_FACT | Backward compatibility (nginx_vhosts)
set_fact:
nginx_sites: "{{ nginx_vhosts }}"
when: nginx_vhosts is defined
- name: SET_FACT | Backward compatibility (nginx_default_vhost_ssl)
set_fact:
nginx_default_site_ssl: "{{ nginx_default_vhost_ssl }}"
when: nginx_default_vhost_ssl is defined
- name: SET_FACT | Backward compatibility (nginx_default_vhost)
set_fact:
nginx_default_site: "{{ nginx_default_vhost }}"
when: nginx_default_vhost is defined
- name: SHELL | Get Nginx version
shell: nginx -v 2>&1 | sed -r 's#.*/##;' | cut -d ' ' -f 1
args:
executable: /bin/sh
register: nginx_version
changed_when: false
check_mode: no
- name: SHELL | Get module list
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
changed_when: false
check_mode: no
- name: SET_FACT | Save modules
set_fact:
nginx_modules: "{{ shell_modules.stdout_lines }}"
- name: FILE | Create folders
file: dest="{{ item.dir }}" owner="{{ item.owner }}" mode="{{ item.mode }}" state=directory
with_items: "{{ nginx_dirs }}"
- name: FILE | Create ansible facts dir
file: path=/etc/ansible/facts.d state=directory