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