%global dlrn_nvr ansible-2.5.0-0.1.20171208095629.882065b %global dlrn 1 %define upstream_version 2.5.0 # we don't build docs in dlrn to speed up the compilation (at least 40mn to build doc...) # and on anything else than fedora and RHEL >= 8 %if !(0%{?fedora} || 0%{?rhel} >= 8) || 0%{?dlrn} %define nodoc 1 %endif # RHEL 6 didn't have a __python2 macro. # Amazon Linux 2015.9 is based on RHEL6, with /usr/bin/python2 -> python2.6, while # /usr/bin/python -> python2.7. Explicitly use python2.6. %if 0%{?rhel} == 6 || 0%{?rhel} == 5 %global __python2 /usr/bin/python2.6 %endif %if 0%{?rhel} <= 5 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot %endif %if 0%{?fedora} %global with_python3 1 %else %global with_python3 0 %endif %{!?python_sitelib: %global python_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} Name: ansible Summary: SSH-based configuration management, deployment, and task execution system Version: 2.5.0 Release: 0.1.20171208095629.882065b%{?dist} Group: Development/Libraries License: GPLv3+ Source0: ansible-2.5.0-0.1.20171208095629.882065b.tar.gz # Patch to utilize a newer jinja2 package on epel6 # Non-upstreamable as it creates a dependency on a specific version of jinja. # This is desirable for us as we have packages for that version but not for # upstream as they don't know what their customers are running. Patch100: ansible-newer-jinja.patch # temprary patches for dlrn packaging (devel branch) #Patch1001: ansible-mock-ncclient-import.patch Url: http://ansible.com BuildArch: noarch %if 0%{?rhel} && 0%{?rhel} <= 5 BuildRequires: python26-devel Requires: python26-PyYAML Requires: python26-paramiko Requires: python26-jinja2 Requires: python26-keyczar %else # for the netconf module Requires: python-ncclient BuildRequires: python2-devel BuildRequires: python-setuptools # For building docs BuildRequires: python-sphinx # For tests # We don't run tests on epel6, so don't bother pulling these in there. %if (0%{?fedora} || 0%{?rhel} > 6) BuildRequires: which BuildRequires: PyYAML BuildRequires: python-boto BuildRequires: python-netaddr BuildRequires: python-crypto BuildRequires: python-paramiko BuildRequires: python-keyczar BuildRequires: python-six BuildRequires: python-nose BuildRequires: python-coverage BuildRequires: python-mock BuildRequires: python-boto3 BuildRequires: python-botocore BuildRequires: python-passlib BuildRequires: python-lxml #BuildRequires: python-xmljson BuildRequires: python-requests # for the netconf module BuildRequires: python-ncclient # rhel7 does not have python-pytest but has pytest %if 0%{?rhel} > 6 BuildRequires: pytest #BuildRequires: python-pytest-xdist #BuildRequires: python-pytest-mock %else BuildRequires: python-pytest BuildRequires: python-pytest-xdist BuildRequires: python-pytest-mock %endif %endif %if (0%{?rhel} && 0%{?rhel} <= 6) # Ansible will work with the jinja2 shipped with RHEL6 but users can gain # additional jinja features by using the newer version Requires: python-jinja2-26 BuildRequires: python-jinja2-26 # Distros with python < 2.7.0 BuildRequires: python-unittest2 %else Requires: python-jinja2 BuildRequires: python-jinja2 %endif Requires: PyYAML Requires: python-crypto Requires: python-paramiko Requires: python-keyczar Requires: python-httplib2 Requires: python-setuptools Requires: python-six Requires: sshpass # needed for json_query filter Requires: python2-jmespath %endif %if 0%{?rhel} == 6 # RHEL 6 needs a newer version of the pycrypto library for the ansible-vault # command. Note: If other pieces of ansible also grow to need pycrypto you may # need to add: Requires: python-crypto or patch the other pieces of ansible to # make use of this forward compat package (see the patch for ansible-vault # above to see what needs to be done.) Requires: python-crypto2.6 # The python-2.6 stdlib json module has a bug that affects the ansible # to_nice_json filter Requires: python-simplejson # For testing BuildRequires: python-crypto2.6 BuildRequires: python-simplejson %endif # # This is needed to update the old ansible-firewall package that is no # longer needed. Note that you should also remove ansible-node-firewall manually # Where you still have it installed. # Provides: ansible-fireball = %{version}-%{release} Obsoletes: ansible-fireball < 1.2.4 %description Ansible is a radically simple model-driven configuration management, multi-node deployment, and remote task execution system. Ansible works over SSH and does not require any software or daemons to be installed on remote nodes. Extension modules can be written in any language and are transferred to managed machines automatically. %if 0%{?with_python3} # Note, ansible is not intended to be used as a library so avoiding the # python3-ansible and python2-ansible package names so we don't confuse users. # Also note, similarly to dnf in its transition period, the python2 and python3 # versions of ansible should behave identically but python3-only bugs may be present. # So upstream would like us to ship both py2 and py3 ansible (at least in # rawhide) for people to beat on and find bugs. %package -n ansible-python3 Summary: SSH-based configuration management, deployment, and task execution system BuildRequires: python3-devel BuildRequires: python3-setuptools # For tests BuildRequires: python3-PyYAML BuildRequires: python3-paramiko BuildRequires: python3-crypto # accelerate is the only thing that makes keyczar mandatory. Since accelerate # is deprecated, just ignore it #BuildRequires: python-keyczar BuildRequires: python3-six BuildRequires: python3-nose BuildRequires: python3-pytest BuildRequires: python3-pytest-xdist BuildRequires: python3-pytest-mock BuildRequires: python3-coverage BuildRequires: python3-mock BuildRequires: python3-boto3 BuildRequires: python3-botocore BuildRequires: python3-passlib BuildRequires: python3-jinja2 BuildRequires: python3-requests Requires: python3-PyYAML Requires: python3-paramiko Requires: python3-crypto # accelerate is the only thing that makes keyczar mandatory. Since accelerate # is deprecated, just ignore it #Requires: python3-keyczar Requires: python3-setuptools Requires: python3-six Requires: python3-jinja2 Requires: sshpass # needed for json_query filter Requires: python3-jmespath %endif %if 0%{?with_python3} %description -n ansible-python3 Ansible is a radically simple model-driven configuration management, multi-node deployment, and remote task execution system. Ansible works over SSH and does not require any software or daemons to be installed on remote nodes. Extension modules can be written in any language and are transferred to managed machines automatically. This package installs versions of ansible that execute on Python3. %endif # with_python3 %package -n ansible-doc Summary: Documentation for Ansible %description -n ansible-doc Ansible is a radically simple model-driven configuration management, multi-node deployment, and remote task execution system. Ansible works over SSH and does not require any software or daemons to be installed on remote nodes. Extension modules can be written in any language and are transferred to managed machines automatically. This package installs extensive documentation for ansible %prep %setup -q echo 0%{?fedora} 0%{?rhel} 0%{?with_python3} %if 0%{?rhel} == 6 %patch100 -p1 %endif # temporary patches for DLRN #%patch1001 -p1 %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} %endif # with_python3 %build %{__python2} setup.py build # Build docs # EPEL6/7 don't have a recent enough sphinx to build the docs %if !0%{?nodoc} make webdocs %endif %if 0%{?with_python3} pushd %{py3dir} %py3_build popd %endif # with_python3 %install %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --root=$RPM_BUILD_ROOT popd for i in $RPM_BUILD_ROOT/%{_bindir}/ansible* ; do mv $i $i-%{python3_version} ln -s %{_bindir}/$(basename $i)-%{python3_version} $i-3 done %endif # with_python3 %{__python2} setup.py install --root=$RPM_BUILD_ROOT for i in $RPM_BUILD_ROOT/%{_bindir}/{ansible,ansible-console,ansible-doc,ansible-galaxy,ansible-playbook,ansible-pull,ansible-vault} ; do mv $i $i-%{python2_version} ln -s %{_bindir}/$(basename $i)-%{python2_version} $i ln -s %{_bindir}/$(basename $i)-%{python2_version} $i-2 done mkdir -p $RPM_BUILD_ROOT/etc/ansible/ mkdir -p $RPM_BUILD_ROOT/etc/ansible/roles/ cp examples/hosts $RPM_BUILD_ROOT/etc/ansible/ cp examples/ansible.cfg $RPM_BUILD_ROOT/etc/ansible/ %if !0%{?nodoc} mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1 cp -v docs/man/man1/*.1 $RPM_BUILD_ROOT/%{_mandir}/man1/ %endif cp -pr docs/docsite/rst . %if !0%{?nodoc} cp -pr docs/docsite/_build/html . %endif %check # RHEL <= 6 doesn't have a new enough python-mock to run the tests # Currently RHEL <= 7 doesn't have pytest-xdist or a new enough pytest # Fedora 25 doesn't have a new enough pytest %if 0%{?fedora} >= 26 || 0%{?rhel} >= 8 if test -z $(which pytest) ; then mkdir tests_bin pushd tests_bin ln -s `which py.test` pytest export PATH=$PATH:$(pwd) popd fi make tests %if 0%{?with_python3} pushd %{py3dir} if test -z $(which pytest) ; then mkdir tests_bin pushd tests_bin ln -s `which py.test` pytest export PATH=$PATH:$(pwd) popd fi make tests-py3 %endif # python3 %endif # New enough Fedora/RHEL %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %{python_sitelib}/ansible* %{_bindir}/ansible* %if 0%{?with_python3} %exclude %{_bindir}/ansible*-3* %endif # python3 %config(noreplace) %{_sysconfdir}/ansible/ %doc README.md PKG-INFO COPYING CHANGELOG.md %if !0%{?nodoc} %doc %{_mandir}/man1/ansible* %endif %if 0%{?with_python3} %files -n ansible-python3 %defattr(-,root,root,-) %{python3_sitelib}/ansible* %{_bindir}/ansible*-3* %config(noreplace) %{_sysconfdir}/ansible/ %doc README.md PKG-INFO COPYING CHANGELOG.md %if !0%{?nodoc} %doc %{_mandir}/man1/ansible* %endif %endif # python3 %files -n ansible-doc %doc rst %if !0%{?nodoc} %doc html %endif %changelog