Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
lfbear committed Feb 27, 2019
1 parent a50aae7 commit 1752292
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If you are trying to use it and not like CLI, you can try me now. I can provide
## How to install

- [preparatory work] python version >= 3.7 (use asyncio featrue)
- pip3 install git+https://github.com/lfbear/ansible-api.git
- ```pip3 install ansible-api```

## How to start it

Expand Down
16 changes: 13 additions & 3 deletions data/api.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ==============================================
# Config file for Ansible-Api
#
# A restful http api for ansible 2.x
# A restful HTTP API for ansible
# I am not a part of ansible official code
# ==============================================

Expand All @@ -12,25 +12,35 @@

#listen host
host = 127.0.0.1

#listen port
port = 8765

#signature string for api call
sign_key = YOUR_SIGNATURE_KEY_HERE

#log path if using daemon mode
log_path = /var/log/ansible-api.log

#worker number (default: 1)
workers = 1

#response of a task will be timeout (sec, default: 3600 [1 hour], task will NOT break off after timeout)
timeout = 3600

#websocket subprotocols
ws_sub =

#ip white list (multiple separated by space, leave a blank for all allowed)
allow_ip =

##
# Optional configuration part
# if you wanna use the feature of file managing
# the path part for playbooks and scripts
#
[directory]

#your playbook path (file *.yml in this dir will be worked)
playbook =

#your script path (file *.sh in this dir will be worked)
script =
32 changes: 18 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
import sys
import pkg_resources



sys.path.insert(0, os.path.abspath('src'))
from ansible_api import __version__

Expand Down Expand Up @@ -45,13 +43,12 @@ def run(self):
if LooseVersion(ansible.__version__) >= LooseVersion(ABSIBLE_REQUIRE) and \
LooseVersion(pkg_resources.require("ansible_runner")[0].version) >= LooseVersion(ABSIBLER_REQUIRE):
install.run(self)
# self.init_plugin_file(path)
self.init_config_file()
print("\033[1;37mAnsible-api v%s install complete.\033[0m" %
__version__)
else:
print("Error: ansible [%s] or ansible-runner [%s] version too low" %
(ansible_runner.__version__,pkg_resources.require("ansible_runner")[0].version))
(ansible_runner.__version__, pkg_resources.require("ansible_runner")[0].version))

def init_config_file(self):
for p in self._configfiles:
Expand All @@ -66,16 +63,9 @@ def init_config_file(self):
print(
"\033[4;37mConfiguration file exists: %s\033[0m" % file)

def init_plugin_file(self, ansible_path):
for p in self._pluginfiles:
path = p[0]
if path[0:1] != '/':
path = os.path.join(ansible_path, path)
for f in p[1]:
file = os.path.join(path, os.path.basename(f))
os.system(' '.join(['cp', f, file]))
print("Plugin file: %s copy successfully" % file)

with open("README.md", "r") as fh:
long_description = fh.read()

setup(
name='ansible-api',
Expand All @@ -92,6 +82,20 @@ def init_plugin_file(self, ansible_path):
author="lfbear",
author_email="[email protected]",
description="A restful HTTP API for ansible",
long_description=long_description,
long_description_content_type="text/markdown",
license="GPLv3",
url="https://github.com/lfbear/ansible-api"
url="https://github.com/lfbear/ansible-api",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3.7",
"Operating System :: OS Independent",
"Topic :: System :: Systems Administration",
"Topic :: Utilities",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
],
project_urls={ # Optional
'Bug Reports': 'https://github.com/lfbear/ansible-api/issues',
'Source': 'https://github.com/lfbear/ansible-api',
},
)

0 comments on commit 1752292

Please sign in to comment.