--- # Основные задачи для роли nginx # Автор: Сергей Антропов # Сайт: https://devops.org.ru - name: Установка nginx на Ubuntu/Debian apt: name: "{{ nginx_ubuntu_packages }}" state: present update_cache: true when: ansible_os_family == "Debian" tags: - nginx - install - debian - name: Установка nginx на RHEL/CentOS yum: name: "{{ nginx_rhel_packages }}" state: present when: ansible_os_family == "RedHat" tags: - nginx - install - rhel - name: Включение и запуск nginx на Ubuntu/Debian systemd: name: nginx enabled: true state: started when: ansible_os_family == "Debian" tags: - nginx - service - debian - name: Включение и запуск nginx на RHEL/CentOS systemd: name: nginx enabled: true state: started when: ansible_os_family == "RedHat" tags: - nginx - service - rhel - name: Создание директории для веб-контента file: path: "{{ nginx_root_dir }}" state: directory owner: "{{ nginx_user }}" group: "{{ nginx_user }}" mode: '0755' tags: - nginx - config - directories - name: Создание тестовой страницы copy: content: |
Сервер: {{ ansible_hostname }}
ОС: {{ ansible_distribution }} \ {{ ansible_distribution_version }}
Время: {{ ansible_date_time.iso8601 }}
Роль: nginx (Сергей Антропов)