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