ansible-role-uwsgi/tasks/uwsgi_install.yml

60 lines
1.9 KiB
YAML

---
# Copyright 2019, VEXXHOST, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Create uWSGI system group
group:
name: "{{ uwsgi_system_group_name }}"
state: "present"
system: "yes"
- name: Create uWSGI system user
user:
name: "{{ uwsgi_system_user_name }}"
group: "{{ uwsgi_system_group_name }}"
comment: "uwsgi user"
shell: "/bin/false"
system: "yes"
createhome: "yes"
home: "/var/lib/{{ uwsgi_system_user_name }}"
- name: Install distro packages
package:
name: "{{ uwsgi_package_list }}"
state: "{{ uwsgi_package_state }}"
update_cache: "{{ (ansible_pkg_mgr in ['apt', 'zypper']) | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_distribution | lower == 'debian') | ternary(cache_timeout, omit) }}"
register: install_packages
until: install_packages is success
retries: 5
delay: 2
notify:
- Manage LB
- Restart uwsgi services
when: uwsgi_install_method == 'distro'
- name: Install the python venv
import_role:
name: "python_venv_build"
vars:
venv_install_destination_path: "{{ uwsgi_bin | dirname }}"
venv_pip_install_args: "{{ uwsgi_pip_install_args }}"
venv_pip_packages: "{{ uwsgi_pip_packages }}"
venv_python_executable: "{{ uwsgi_python_executable }}"
venv_facts_when_changed:
- section: 'uwsgi'
option: 'venv_tag'
value: uwsgi_venv_tag
when: uwsgi_install_method == 'source'