diff --git a/pkgs/development/python-modules/ansible/default.nix b/pkgs/development/python-modules/ansible/default.nix new file mode 100644 index 000000000000..1daff95d3a85 --- /dev/null +++ b/pkgs/development/python-modules/ansible/default.nix @@ -0,0 +1,53 @@ +{ lib +, fetchurl +, buildPythonPackage +, pycrypto +, paramiko +, jinja2 +, pyyaml +, httplib2 +, boto +, six +, netaddr +, dnspython +, jmespath +, dopy +, windowsSupport ? false +, pywinrm +}: + +buildPythonPackage rec { + pname = "ansible"; + version = "2.7.8"; + + src = fetchurl { + url = "https://releases.ansible.com/ansible/${pname}-${version}.tar.gz"; + sha256 = "11yx7vd0mp5gkq428af141dwnrwf8f9cp3f65243qbs9icjxnrrx"; + }; + + prePatch = '' + sed -i "s,/usr/,$out," lib/ansible/constants.py + ''; + + postInstall = '' + for m in docs/man/man1/*; do + install -vD $m -t $out/share/man/man1 + done + ''; + + propagatedBuildInputs = [ + pycrypto paramiko jinja2 pyyaml httplib2 boto + six netaddr dnspython jmespath dopy + ] ++ lib.optional windowsSupport pywinrm; + + # dificult to test + doCheck = false; + + meta = with lib; { + homepage = http://www.ansible.com; + description = "Radically simple IT automation"; + license = [ licenses.gpl3 ] ; + maintainers = with maintainers; [ jgeerds joamaki costrouc ]; + platforms = platforms.linux ++ platforms.darwin; + }; +} diff --git a/pkgs/tools/admin/ansible/default.nix b/pkgs/tools/admin/ansible/default.nix index 58798a92b159..f9cc3fb4ebcb 100644 --- a/pkgs/tools/admin/ansible/default.nix +++ b/pkgs/tools/admin/ansible/default.nix @@ -1,72 +1,27 @@ -{ stdenv, fetchurl, python2 -, windowsSupport ? false -}: +{ python3Packages, fetchurl }: -let - generic = { version, sha256, py ? python2 }: py.pkgs.buildPythonPackage rec { +{ + ansible = with python3Packages; toPythonApplication ansible; + + ansible_2_7 = with python3Packages; toPythonApplication ansible; + + ansible_2_6 = with python3Packages; toPythonApplication (ansible.overridePythonAttrs(old: rec { pname = "ansible"; - inherit version; - - outputs = [ "out" "man" ]; + version = "2.6.9"; src = fetchurl { url = "https://releases.ansible.com/ansible/${pname}-${version}.tar.gz"; - inherit sha256; + sha256 = "12mysvdavkypgmyms1wjq2974lk97w893k23i6khigxrjj6r85z1"; }; + })); - prePatch = '' - sed -i "s,/usr/,$out," lib/ansible/constants.py - ''; + ansible_2_5 = with python3Packages; toPythonApplication (ansible.overridePythonAttrs(old: rec { + pname = "ansible"; + version = "2.5.14"; - postInstall = '' - wrapPythonProgramsIn "$out/bin" "$out $PYTHONPATH" - - for m in docs/man/man1/*; do - install -vD $m -t $man/share/man/man1 - done - ''; - - doCheck = false; - dontStrip = true; - dontPatchELF = true; - dontPatchShebangs = false; - - propagatedBuildInputs = with py.pkgs; [ - pycrypto paramiko jinja2 pyyaml httplib2 boto six netaddr dnspython jmespath dopy - ] ++ stdenv.lib.optional windowsSupport pywinrm; - - meta = with stdenv.lib; { - homepage = http://www.ansible.com; - description = "A simple automation tool"; - license = with licenses; [ gpl3 ] ; - maintainers = with maintainers; [ jgeerds joamaki ]; - platforms = with platforms; linux ++ darwin; + src = fetchurl { + url = "https://releases.ansible.com/ansible/${pname}-${version}.tar.gz"; + sha256 = "0sd04h2k5qv4m48dn76jkjlwlqfdk15hzyagj9i71r8brvmwhnk9"; }; - }; - -in rec { - # We will carry all the supported versions - - ansible_2_4 = generic { - version = "2.4.4.0"; - sha256 = "0n1k6h0h6av74nw8vq98fmh6q4pq6brpwmx45282vh3bkdmpa0ib"; - }; - - ansible_2_5 = generic { - version = "2.5.11"; - sha256 = "07rhgkl3a2ba59rqh9pyz1p661gc389shlwa2sw1m6wwifg4lm24"; - }; - - ansible_2_6 = generic { - version = "2.6.7"; - sha256 = "10pakw9k9wd3cy1qk3ah2253ph7c7h3qzpal4k0s5lschzgy2fh0"; - }; - - ansible_2_7 = generic { - version = "2.7.6"; - sha256 = "0f7b2ghm34ql8yv90wr0ngd6w7wyvnlcxpc3snkj86kcjsnmx1bd"; - }; - - ansible2 = ansible_2_7; - ansible = ansible2; + })); } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4ca0101f3096..903008711db8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8295,13 +8295,11 @@ in augeas = callPackage ../tools/system/augeas { }; - inherit (callPackages ../tools/admin/ansible {}) - ansible_2_4 + inherit (callPackage ../tools/admin/ansible { }) + ansible ansible_2_5 ansible_2_6 - ansible_2_7 - ansible2 - ansible; + ansible_2_7; ansible-lint = callPackage ../development/tools/ansible-lint {}; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 2879cf8432a0..a66a22a78b9a 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -912,6 +912,14 @@ in { allpairspy = callPackage ../development/python-modules/allpairspy { }; + ansible = callPackage ../development/python-modules/ansible { }; + + ansible-kernel = callPackage ../development/python-modules/ansible-kernel { }; + + ansible-lint = callPackage ../development/python-modules/ansible-lint { }; + + ansible-runner = callPackage ../development/python-modules/ansible-runner { }; + ansicolors = callPackage ../development/python-modules/ansicolors {}; aniso8601 = callPackage ../development/python-modules/aniso8601 {};