From 4ee77ce0263370535b4d99c294445740977727ad Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Fri, 18 Aug 2017 11:46:17 +0200 Subject: [PATCH] Add an RPM spec file and customize ansible roles_path Install roles under /usr/local/share/kubespray/roles, playbooks - /usr/local/share/kubespray/playbooks/, ansible.cfg and inventory group vars - into /etc/kubespray. Ship README and an example inventory as the package docs. Update the ansible.cfg to consume the roles from the given path, including virtualenvs prefix, if defined. Signed-off-by: Bogdan Dobrelya --- ansible.cfg | 1 + contrib/ansible-kubespray.spec | 57 ++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 contrib/ansible-kubespray.spec diff --git a/ansible.cfg b/ansible.cfg index d1741836a..aecb198a0 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -10,3 +10,4 @@ fact_caching_connection = /tmp stdout_callback = skippy library = ./library callback_whitelist = profile_tasks +roles_path = roles:$VIRTUAL_ENV/usr/local/share/kubespray/roles:$VIRTUAL_ENV/usr/local/share/ansible/roles diff --git a/contrib/ansible-kubespray.spec b/contrib/ansible-kubespray.spec new file mode 100644 index 000000000..53a67898f --- /dev/null +++ b/contrib/ansible-kubespray.spec @@ -0,0 +1,57 @@ +%global srcname ansible_kubespray + +%{!?upstream_version: %global upstream_version %{version}%{?milestone}} + +Name: ansible-kubespray +Version: XXX +Release: XXX +Summary: Ansible modules for installing Kubernetes clusters + +Group: System Environment/Base +License: ASL 2.0 +URL: https://github.com/kubernetes-incubator/kubespray +Source0: https://github.com/kubernetes-incubator/kubespray/archive/%{upstream_version}.tar.gz + +BuildArch: noarch +BuildRequires: git +BuildRequires: python2-devel +BuildRequires: python-setuptools +BuildRequires: python-d2to1 +BuildRequires: python-pbr + +Requires: ansible +Requires: python-jinja2 +Requires: python-netaddr + +%description + +Ansible-kubespray is a set of Ansible modules and playbooks for installing +a Kubernetes cluster. + +%prep +%autosetup -n %{name}-%{upstream_version} -S git + + +%build +%{__python2} setup.py build + + +%install +export PBR_VERSION=%{version} +export SKIP_PIP_INSTALL=1 +%{__python2} setup.py install --skip-build --root %{buildroot} + + +%files +%doc README.md +%doc inventory/inventory.example +%config /etc/kubespray/ansible.cfg +%config /etc/kubespray/inventory/group_vars/all.yml +%config /etc/kubespray/inventory/group_vars/k8s-cluster.yml +%license LICENSE +%{python2_sitelib}/%{srcname}-%{version}-py%{python2_version}.egg-info +/usr/local/share/kubespray/roles/ +/usr/local/share/kubespray/playbooks/ + + +%changelog