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