我有使用nixos的计算机(使用terraform,config进行了配置),我想使用deployment.targetHost = ipAddress
和deployment.targetEnv = "none"
连接到它
但是我无法将nixops配置为使用/secrets/stage_ssh_key
ssh键
这不起作用(实际上没有记录,我在这里https://github.com/NixOS/nixops/blob/d4e5b779def1fc9e7cf124930d0148e6bd670051/nixops/backends/none.py#L33-L35找到了)
{
stage =
{ pkgs, ... }:
{
deployment.targetHost = (import ./nixos-generated/stage.nix).terraform.ip;
deployment.targetEnv = "none";
deployment.none.sshPrivateKey = builtins.readFile ./secrets/stage_ssh_key;
deployment.none.sshPublicKey = builtins.readFile ./secrets/stage_ssh_key.pub;
deployment.none.sshPublicKeyDeployed = true;
environment.systemPackages = with pkgs; [
file
];
};
}
nixops ssh stage
导致要求输入密码-无需密码即可登录
nixops ssh stage -i ./secrets/stage_ssh_key
正常工作,不要求输入密码
如何复制:
rm -rf secrets/*
在secrets/aws.nix
{
EC2_ACCESS_KEY="XXXX";
EC2_SECRET_KEY="XXXX";
}
nix-shell
make generate_stage_ssh_key
terraform apply
make nixops_create
nixops deploy
询问密码