Skip to content

Instantly share code, notes, and snippets.

@bradparker
Last active September 8, 2020 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradparker/b1c07d9ec439d30739d7dec32d1feee9 to your computer and use it in GitHub Desktop.
Save bradparker/b1c07d9ec439d30739d7dec32d1feee9 to your computer and use it in GitHub Desktop.
Ansible shell
TASK [Find or create a linode] *********************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'linode_api4'
failed: [localhost] (item=27) => {"ansible_loop_var": "item", "changed": false, "item": "27", "msg": "Failed to import the required Python library (linode-api4) on FGFMAC66.local's Python /nix/store/51ly5wgcjmv9g23156kjsd4x9m102zxf-python3-3.7.8/bin/python3. Please read module documentation and install in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter"}
let
nixpkgs =
import (builtins.fetchTarball {
url = https://releases.nixos.org/nixpkgs/nixpkgs-20.09pre242401.ebd2e632d61/nixexprs.tar.xz;
}) {};
linode_api4 =
{
buildPythonPackage,
fetchPypi,
requests,
future,
}:
buildPythonPackage rec {
pname = "linode_api4";
version = "2.3.5";
propagatedBuildInputs = [ requests future ];
src = fetchPypi {
inherit pname version;
sha256 = "0n28420r3n6f716ghsx46dn3v5c90fv1cydn884q3cb5qnmrn3zr";
};
doCheck = false;
};
python37 = nixpkgs.python37.withPackages (packages:
with packages; [
ansible
(callPackage linode_api4 {})
]
);
in
nixpkgs.stdenv.mkDerivation {
pname = "infrastructure";
version = "1.0.0";
buildInputs = with nixpkgs; [
python37
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment