【发布时间】:2017-09-26 18:43:39
【问题描述】:
---
- hosts: localhost
gather_facts: False
roles:
- provision_ec2
# this uses a variable defined in the first role of this playbook, provision_ec2.
- hosts: "{{ hostvars['localhost'].bastion_server_group }}"
become: yes
become_method: sudo
roles:
- hosts_file
# this won't work on bastion servers until we automate a way to connect to the newly provisioned bastion server.
# This would require some proxy command and attaching an elastic IP, then pushing that to the ssh_config.
因为现在我们每次启动新堡垒服务器时都会手动执行上述 cmets,所以我需要您的帮助来了解如何自动化将弹性 IP 附加到新配置的堡垒服务器的过程?我是 Yaml 和 ansible 的新手,最近几周我正在学习 yaml。
- hosts: '{{HOST_GROUP}}'
gather_facts: False
roles:
- { role: ec2_tags, when: server_type != 'bastion' }
- { role: ec2_tag_volumes, when: server_type == 'app' or server_type == 'util' }
【问题讨论】: