Compare commits

...

11 Commits

Author SHA1 Message Date
openeuler-ci-bot
cb98f53712
!16 解决服务无法使用问题
From: @crrs666 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
2023-03-14 02:14:40 +00:00
wangdi
2888fa60bb Be compatible with pyyaml 6.x 2023-03-14 09:24:26 +08:00
wangdi
d83f3c92c6 Add missing requires 2023-03-14 09:19:23 +08:00
openeuler-ci-bot
d4424bfd7e
!15 [sync] PR-14: Add requires to provide the semanage command
From: @openeuler-sync-bot 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
2022-08-23 02:47:03 +00:00
jxy_git
cf58f71755 Add requires to provide the semanage command
(cherry picked from commit dbb810fa8c59798efed046062b3f7c4fcc93d5f7)
2022-08-23 10:40:34 +08:00
openeuler-ci-bot
b907e14bd1
!9 Modify the YAML file
From: @liqiuyu123 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
2022-04-07 06:34:31 +00:00
liqiuyu
b01e6b35b7 Modify the YAML file 2022-04-07 14:22:17 +08:00
openeuler-ci-bot
91300e39bb
!8 Add yaml field
From: @liqiuyu123 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
2022-04-07 06:18:26 +00:00
liqiuyu
cfd5215550 add yaml file 2022-04-07 14:11:02 +08:00
openeuler-ci-bot
b88b49ffb8 !1 Package init
From: @lyn1001
Reviewed-by: @jxy_git
Signed-off-by: @jxy_git
2021-09-02 12:09:05 +00:00
lyn1001
c9401c88b7 package init 2021-09-02 17:16:04 +08:00
6 changed files with 157 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,76 @@
Name: ansible-runner-service
Version: 1.0.7
Release: 4
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
Patch2: be-compatible-with-pyyaml-6.x.patch
BuildArch: noarch
BuildRequires: systemd python3-devel python3-setuptools
Requires: ansible
Requires: logrotate
Requires: openssl
Requires: openssh
Requires: openssh-clients
Requires: policycoreutils-python-utils
Requires: python3
Requires: python3-ansible-runner
Requires: python3-pyOpenSSL
Requires: python3-netaddr
Requires: python3-notario
Requires: python3-flask
Requires: python3-flask-restful
Requires: python3-psutil
%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
* Tue Mar 14 2023 wangdi <wangdi@kylinos.cn> - 1.0.7-4
- Be compatible with pyyaml 6.x
* Tue Mar 14 2023 wangdi <wangdi@kylinos.cn> - 1.0.7-3
- Add missing requires
* Tue Aug 23 2022 jiangxinyu <jiangxinyu@kylinos.cn> - 1.0.7-2
- Add requires to provide the semanage command
* Wed Aug 25 2021 huanghaitao <huanghaitao8@huawei.com> - 1.0.7-1
- package init

View File

@ -0,0 +1,4 @@
version_control: github
src_repo: ansible/ansible-runner-service
tag_prefix: ^
separator: "."

View File

@ -0,0 +1,25 @@
From cfb3d7cdb6936afe61018fa2062ae05dcf5b0b2d Mon Sep 17 00:00:00 2001
From: wangdi <wangdi@kylinos.cn>
Date: Tue, 14 Mar 2023 09:22:33 +0800
Subject: [PATCH] be compatible with pyyaml 6.x
---
runner_service/configuration.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/runner_service/configuration.py b/runner_service/configuration.py
index d7a5c17..71a1307 100644
--- a/runner_service/configuration.py
+++ b/runner_service/configuration.py
@@ -106,7 +106,7 @@ class Config(object):
try:
with open(self.config_file, "r") as _cfg:
- local_config = yaml.load(_cfg.read())
+ local_config = yaml.safe_load(_cfg.read())
except yaml.YAMLError as exc:
logger.critical("ERROR: YAML error in configuration "
"file: {}".format(exc))
--
2.39.1

29
ovirt_log.patch Normal file
View 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
View 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()