1{ lib
2, buildPythonPackage
3, fetchPypi
4, ansible-base
5, jsonschema
6, jxmlease
7, ncclient
8, netaddr
9, paramiko
10, pynetbox
11, scp
12, textfsm
13, ttp
14, xmltodict
15, withJunos ? false
16, withNetbox ? false
17}:
18
19buildPythonPackage rec {
20 pname = "ansible";
21 version = "3.4.0";
22 format = "setuptools";
23
24 src = fetchPypi {
25 inherit pname version;
26 sha256 = "096rbgz730njk0pg8qnc27mmz110wqrw354ca9gasb7rqg0f4d6a";
27 };
28
29 postPatch = ''
30 # make ansible-base depend on ansible-collection, not the other way around
31 sed -i '/ansible-base/d' setup.py
32 '';
33
34 propagatedBuildInputs = lib.unique ([
35 # Support ansible collections by default, make all others optional
36 # ansible.netcommon
37 jxmlease
38 ncclient
39 netaddr
40 paramiko
41 xmltodict
42 # ansible.posix
43 # ansible.utils
44 jsonschema
45 textfsm
46 ttp
47 xmltodict
48 # ansible.windows
49
50 # lots of collections with dedicated requirements.txt and pyproject.toml files,
51 # add the dependencies for the collections you need conditionally and install
52 # ansible using overrides to enable the collections you need.
53 ] ++ lib.optionals (withJunos) [
54 # ansible_collections/junipernetworks/junos/requirements.txt
55 jxmlease
56 ncclient
57 paramiko
58 scp
59 xmltodict
60 ] ++ lib.optionals (withNetbox) [
61 # ansible_collections/netbox/netbox/pyproject.toml
62 pynetbox
63 ]);
64
65 # don't try and fail to strip 48000+ non strippable files, it takes >5 minutes!
66 dontStrip = true;
67
68 # difficult to test
69 doCheck = false;
70
71 meta = with lib; {
72 description = "Radically simple IT automation";
73 homepage = "http://www.ansible.com";
74 license = licenses.gpl3Plus;
75 maintainers = with maintainers; [ hexa ];
76 };
77}