package init
(cherry picked from commit c9401c88b719624a38eea99ce000f94deb5e8ddb)
This commit is contained in:
parent
99fd6a58b8
commit
1f0d26f88e
BIN
ansible-runner-service-1.0.7.tar.gz
Normal file
BIN
ansible-runner-service-1.0.7.tar.gz
Normal file
Binary file not shown.
52
ansible-runner-service.spec
Normal file
52
ansible-runner-service.spec
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
Name: ansible-runner-service
|
||||||
|
Version: 1.0.7
|
||||||
|
Release: 1
|
||||||
|
License: ASL 2.0
|
||||||
|
Summary: RESTful API for ansible/ansible_runner execution
|
||||||
|
Source0: https://github.com/ansible/%{name}/archive/%{name}-%{version}.tar.gz
|
||||||
|
Patch0: ovirt_log.patch
|
||||||
|
Patch1: wsgi.patch
|
||||||
|
BuildArch: noarch
|
||||||
|
BuildRequires: systemd python3-devel python3-setuptools
|
||||||
|
|
||||||
|
%global _description %{expand:
|
||||||
|
This package provides the Ansible Runner Service source files. Ansible runner service exposes a REST API interface on top of the functionality provided by ansible and ansible_runner.
|
||||||
|
The Ansible Runner Service provided in this packages is intended to be used as uwgsi app exposed by Nginx in a Container.
|
||||||
|
Dependencies, and configuration tasks must be performed in the container.
|
||||||
|
Ansible Runner Service listens on https://localhost:5001 by default for playbook or ansible inventory requests. For developers interested in using the API, all the available endpoints are documented at https://localhost:5001/api.
|
||||||
|
In addition to the API endpoints, the daemon also provides a /metrics endpoint for prometheus integration. A sample Grafana dashboard is provided within /usr/share/doc/ansible-runner-service}
|
||||||
|
%description %_description
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n %{name}-%{version} -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
%py3_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
%py3_install
|
||||||
|
mkdir -p %{buildroot}%{_sysconfdir}/ansible-runner-service
|
||||||
|
install -m 644 ./config.yaml %{buildroot}%{_sysconfdir}/ansible-runner-service
|
||||||
|
install -m 644 ./logging.yaml %{buildroot}%{_sysconfdir}/ansible-runner-service
|
||||||
|
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
|
||||||
|
install -m 644 ./misc/packaging/logrotate/ansible-runner-service %{buildroot}%{_sysconfdir}/logrotate.d/ansible-runner-service
|
||||||
|
install -m 644 ./ansible_runner_service.py %{buildroot}%{python3_sitelib}/runner_service
|
||||||
|
mkdir -p %{buildroot}%{_var}/www/runnner
|
||||||
|
install -m 644 ./wsgi.py %{buildroot}%{_var}/www/runnner/runner.wsgi
|
||||||
|
|
||||||
|
%post
|
||||||
|
semanage fcontext -a -t httpd_log_t -s system_u /var/log/ovirt-engine/ansible-runner-service.log 2> /dev/null || semanage fcontext -m -t httpd_log_t -s system_u /var/log/ovirt-engine/ansible-runner-service.log || true
|
||||||
|
[[ -f /var/log/ovirt-engine/ansible-runner-service.log ]] && restorecon -rF /var/log/ovirt-engine/ansible-runner-service.log || true
|
||||||
|
|
||||||
|
%files -n ansible-runner-service
|
||||||
|
%{_bindir}/ansible_runner_service
|
||||||
|
%{python3_sitelib}/*
|
||||||
|
%{_sysconfdir}/logrotate.d/ansible-runner-service
|
||||||
|
%config(noreplace) %{_sysconfdir}/ansible-runner-service/*
|
||||||
|
%{_var}/www/runnner/runner.wsgi
|
||||||
|
%license LICENSE.md
|
||||||
|
%doc README.md
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Wed Aug 25 2021 huanghaitao <huanghaitao8@huawei.com> - 1.0.7-1
|
||||||
|
- package init
|
||||||
29
ovirt_log.patch
Normal file
29
ovirt_log.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
diff --git a/logging.yaml b/logging.yaml
|
||||||
|
index 8357727..16a0c1c 100644
|
||||||
|
--- a/logging.yaml
|
||||||
|
+++ b/logging.yaml
|
||||||
|
@@ -7,21 +7,13 @@ formatters:
|
||||||
|
format: "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- console:
|
||||||
|
- class: logging.StreamHandler
|
||||||
|
- level: DEBUG
|
||||||
|
- formatter: simple
|
||||||
|
- stream: ext://sys.stdout
|
||||||
|
-
|
||||||
|
file_handler:
|
||||||
|
- class: logging.handlers.RotatingFileHandler
|
||||||
|
+ class: logging.handlers.WatchedFileHandler
|
||||||
|
level: DEBUG
|
||||||
|
formatter: simple
|
||||||
|
- filename: ansible-runner-service.log
|
||||||
|
+ filename: /var/log/ovirt-engine/ansible-runner-service.log
|
||||||
|
- maxBytes: 10485760 # 10MB
|
||||||
|
- backupCount: 20
|
||||||
|
encoding: utf8
|
||||||
|
|
||||||
|
root:
|
||||||
|
level: DEBUG
|
||||||
|
- handlers: [console, file_handler]
|
||||||
|
+ handlers: [file_handler]
|
||||||
23
wsgi.patch
Normal file
23
wsgi.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
diff --git a/wsgi.py b/wsgi.py
|
||||||
|
index d66f9c5..93fc875 100644
|
||||||
|
--- a/wsgi.py
|
||||||
|
+++ b/wsgi.py
|
||||||
|
@@ -1,6 +1,8 @@
|
||||||
|
+#!/usr/bin/python
|
||||||
|
+
|
||||||
|
import runner_service.configuration as configuration
|
||||||
|
from runner_service.app import create_app
|
||||||
|
-from ansible_runner_service import setup_common_environment, remove_artifacts_init
|
||||||
|
+from runner_service.ansible_runner_service import setup_logging, remove_artifacts_init
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
@@ -14,7 +16,7 @@ It exposes the WSGI callable as a module-level variable named ``application``.
|
||||||
|
configuration.init(mode='prod')
|
||||||
|
|
||||||
|
# Setup log and ssh and other things present in all the environments
|
||||||
|
-setup_common_environment()
|
||||||
|
+setup_logging()
|
||||||
|
|
||||||
|
# Setup remove of artifacts
|
||||||
|
remove_artifacts_init()
|
||||||
Loading…
x
Reference in New Issue
Block a user