1{ lib
2, callPackage
3, buildPythonPackage
4, fetchPypi
5, installShellFiles
6, cryptography
7, jinja2
8, junit-xml
9, lxml
10, ncclient
11, packaging
12, paramiko
13, pexpect
14, psutil
15, pycrypto
16, pyyaml
17, requests
18, scp
19, windowsSupport ? false, pywinrm
20, xmltodict
21}:
22
23let
24 ansible-collections = callPackage ./collections.nix {
25 version = "3.4.0"; # must be < 4.0
26 sha256 = "096rbgz730njk0pg8qnc27mmz110wqrw354ca9gasb7rqg0f4d6a";
27 };
28in
29buildPythonPackage rec {
30 pname = "ansible-base";
31 version = "2.10.15";
32
33 src = fetchPypi {
34 inherit pname version;
35 sha256 = "sha256-RHiBi6gh26FD4SNWjsXTF9yPpKxuFRP3pQFzTlKXa/8=";
36 };
37
38 # ansible_connection is already wrapped, so don't pass it through
39 # the python interpreter again, as it would break execution of
40 # connection plugins.
41 postPatch = ''
42 substituteInPlace lib/ansible/executor/task_executor.py \
43 --replace "[python," "["
44 '';
45
46 nativeBuildInputs = [
47 installShellFiles
48 ];
49
50 propagatedBuildInputs = [
51 # depend on ansible-collections instead of the other way around
52 ansible-collections
53 # from requirements.txt
54 cryptography
55 jinja2
56 packaging
57 pyyaml
58 # optional dependencies
59 junit-xml
60 lxml
61 ncclient
62 paramiko
63 pexpect
64 psutil
65 pycrypto
66 requests
67 scp
68 xmltodict
69 ] ++ lib.optional windowsSupport pywinrm;
70
71 postInstall = ''
72 installManPage docs/man/man1/*.1
73 '';
74
75 # internal import errors, missing dependencies
76 doCheck = false;
77
78 passthru = {
79 collections = ansible-collections;
80 };
81
82 meta = with lib; {
83 description = "Radically simple IT automation";
84 homepage = "https://www.ansible.com";
85 license = licenses.gpl3Plus;
86 maintainers = with maintainers; [ hexa ];
87 };
88}