- Ansible 2 Cloud Automation Cookbook
- Aditya Patawari Vikas Aggarwal
- 200字
- 2021-06-24 18:43:37
How to do it...
Ansible ships with scores of AWS modules. These Ansible modules use AWS Python SDK, called Boto, as dependency and interact with AWS.
- Let us install Boto using Python pip to get started:
$ pip install boto
- Along with Boto, we also need to have a user who has enough privileges to create and delete AWS resources. AWS has a predefined policy called AmazonEC2FullAccess which can be attached to a user. However, we prefer using a more permissive policy since we would be working on other AWS components in the next chapter.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"NotAction": [
"iam:*",
"organizations:*"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "organizations:DescribeOrganization",
"Resource": "*"
}
]
}
- Once we have the policy defined, we need the user's access key ID and secret access key. These can be generated using AWS IAM dashboard. We will protect these keys using Ansible vault. Let us create a secret file with the keys:
---
access_key: AKIAIFA7A4UKUHQ3LLL
secret_key: plmkoij+hy654gbjuyd345789o/-098u
- Now, we encrypt them:
$ ansible-vault encrypt chapter2/roles/ec2/vars/secret.yml
Once we have the Boto library and credentials for a privileged user, we are good to try out some recipes from this chapter.
推薦閱讀
- 機密計算:原理與技術(shù)(網(wǎng)絡(luò)空間安全技術(shù)叢書)
- 軟件架構(gòu)設(shè)計
- 并行數(shù)據(jù)挖掘及性能優(yōu)化:關(guān)聯(lián)規(guī)則與數(shù)據(jù)相關(guān)性分析
- Docker Quick Start Guide
- 水晶石精粹:3ds max & ZBrush三維數(shù)字靜幀藝術(shù)
- 統(tǒng)計學(xué)習(xí)理論與方法:R語言版
- ESP8266 Home Automation Projects
- Machine Learning with the Elastic Stack
- RedHat Linux用戶基礎(chǔ)
- 教育機器人的風(fēng)口:全球發(fā)展現(xiàn)狀及趨勢
- 啊哈C!思考快你一步
- 計算機組成與操作系統(tǒng)
- 手把手教你學(xué)Flash CS3
- 傳感器原理及實用技術(shù)
- Getting Started with Tableau 2019.2