首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用带主从配置的异步拉的AWS实例自动标度

使用带主从配置的异步拉的AWS实例自动标度
EN

Stack Overflow用户
提问于 2015-12-28 16:52:19
回答 1查看 1.7K关注 0票数 5

我目前正在处理AWS实例,并且希望将当前运行在AWS主节点上的所有配置转移到多个只有Ansible的AWS从节点。从节点可以是2或3或更多。当从节点的“利用率”下降或上升时,ansible-pull模型能够自动缩放AWS实例吗?

如何分配节点的AWS群集?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-12-28 19:37:35

虽然这不是一个直接的答案,但在配置自动缩放的情况下,我使用引导模式

在S3 (通过实例的IAM角色验证)上放置git存储库和ansible- role的密钥,并将剧本放在git存储库上。

EC2实例的用户数据为pip install ansibleget secret key from S3get playbook from git repositoryexecute ansible-playbook

如果存在EC2实例的某些角色,则可以拆分S3目录和git路径。

自举机构使自动刻度过程更简单.

Update01: Sample

EC2用户数据示例(尚未测试,作为图像):

代码语言:javascript
复制
#!/bin/bash

yum update -y
pip install -y ansible

aws s3 cp s3://mybucket/web/git_secret_key /root/.ssh/git_secret_key
chmod 600 /root/.ssh/git_secret_key

aws s3 cp s3://mybucket/web/config /root/.ssh/config
chmod 600 /root/.ssh/config

aws s3 cp s3://mybucket/web/ansible_vault_secret_key /root/ansible_vault_secret_key

git clone git://github.com/foo/playbook.git

ansible-playbook -i playbook/inventory/web playbook/web.yml --vault-password-file /root/ansible_vault_secret_key

s3://mybucket/web/config示例:

代码语言:javascript
复制
Host github-bootstrap
  User git
  Port 22
  HostName github.com
  IdentityFile /root/.ssh/git_secret_key
  TCPKeepAlive yes
  IdentitiesOnly yes

Update02:最简单的版本。(无S3/无保险库)

EC2用户数据示例(尚未测试,作为图像):

代码语言:javascript
复制
#!/bin/bash

yum update -y
pip install -y ansible

echo "YOUR GIT SECRET KEY" > /root/.ssh/git_secret_key
chmod 600 /root/.ssh/git_secret_key

cat << EOT > /root/.ssh/config
Host github-bootstrap
  User git
  Port 22
  HostName github.com
  IdentityFile /root/.ssh/git_secret_key
  TCPKeepAlive yes
  IdentitiesOnly yes
EOT
chmod 600 /root/.ssh/config

git clone git://github.com/foo/playbook.git

ansible-playbook -i playbook/inventory/web playbook/web.yml
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34497447

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档