I am working with AWS instances currently and want to transfer all the configuration that is currently running on AWS master node to the multiple AWS slave nodes with Ansible only. Slave nodes may be 2 or 3 or may be more. Is it possible with the ansible-pull
model to automatically scale the AWS instance when the "Utilization" of the slave node goes down or up?
How can I assign the AWS Cluster of the Nodes?
Although it is not a direct answer, in the case of configuring auto-scale, I use Bootstrap Pattern.
Put the secret key for the git repository and ansible-vault on S3 (authenticated by IAM role of instance), and put the playbooks on git repository.
User Data of EC2 instance is
pip install ansible
,get secret key from S3
,get playbook from git repository
andexecute ansible-playbook
.If there are some role of EC2 instance, you can split S3 directory and git path.
Self bootstrap mechanism make the auto-scale process more simple.
Update01: Samples
EC2 User Data Sample (not yet tested, as an image):
s3://mybucket/web/config Sample:
Update02: Most simple ver. (without S3/ansible-vault)
EC2 User Data Sample (not yet tested, as an image):