将节点和客户端文件夹添加到厨师服务器模板中是一个好习惯吗?



我仍在学习有关厨师的知识。我已经引导并将服务器模板上传到远程存储库。但是想知道是否可以安全地将nodes目录添加到remote存储库中,因为它包含精确的服务器passwords

这是一个示例节点

{
  "environment":"production",
  "authorization": {
    "sudo": {
      // The password for the depliy user is set in data_bags/users/deploy.json
      // and should be generated using:
      // openssl passwd -1 "plaintextpassword"
      "users": ["deploy", "vagrant"]
    }
  },
  "vagrant" : {
    "exclusions" : [],
    "name" : "rails-postgres-redis1",
    "ip" : "192.168.50.4"
  },
  "rbenv":{
    "rubies": [
      "2.1.2"
    ],
    "global" : "2.1.2",
    "gems": {
      "2.1.2" : [
        {"name":"bundler"}
      ]
    }
  },
  "monit": {
    "notify_emails" : ["email@example.com"],
    "enable_emails" : false,
    "web_interface" : {
      // the plaintext monit username and password
      "allow" : ["your_username","your_password"]
    },
    "mailserver" : {
      "host" : "mailserver.example.com",
      "port" : "999",
      "username" : "your_username",
      "password" : "your_password",
      "hostname" : "the_hostname"
    }
  },
  "postgresql" : {
    "password" : {
      // this should be generated with:
      // openssl passwd -1 "plaintextpassword"
      // currently test
      "postgres" : "$1$mMK9HNoN$r42n7Q8fKsZabbknlT1Zt1"
    }
  },
  "run_list":
  [
    "role[server]",
    "role[nginx-server]",
    "role[postgres-server]",
    "role[rails-app]",
    "role[redis-server]",
  ]
}

由于可见密码是否可以安全地添加?

如果应该在Gitignore中,则在以后的阶段,如果我们从远程存储库中克隆,那么我们需要从scratch中引导服务器,因为不存在节点目录吗?

有更好的方法还是我在这里错过了什么?

您不需要节点JSON文件的副本来引导节点。安全数据应来自Chef Vault/Hashicorp Vault/任何其他安全存储。非固定数据可以是食谱/包装器食谱/角色/环境/etc的一部分,可以存储在存储库中。如果您确实有单个节点特定的数据,则可以在引导程序过程中使用-j传递它们。

最新更新