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