Created
November 19, 2019 15:19
-
-
Save DiegoTc/e6b9386ab447e12cb702eba511cbce29 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the normal destination variable to use. If you are running Ansible | |
# from outside EC2, then 'public_dns_name' makes the most sense. If you are | |
# running Ansible from within EC2, then perhaps you want to use the internal | |
# address, and should set this to 'private_dns_name'. The key of an EC2 tag | |
# may optionally be used; however the boto instance variables hold precedence | |
# in the event of a collision. | |
destination_variable = public_dns_name | |
# This allows you to override the inventory_name with an ec2 variable, instead | |
# of using the destination_variable above. Addressing (aka ansible_ssh_host) | |
# will still use destination_variable. Tags should be written as 'tag_TAGNAME'. | |
#hostname_variable = tag_Name | |
# For server inside a VPC, using DNS names may not make sense. When an instance | |
# has 'subnet_id' set, this variable is used. If the subnet is public, setting | |
# this to 'ip_address' will return the public IP address. For instances in a | |
# private subnet, this should be set to 'private_ip_address', and Ansible must | |
# be run from within EC2. The key of an EC2 tag may optionally be used; however | |
# the boto instance variables hold precedence in the event of a collision. | |
# WARNING: - instances that are in the private vpc, _without_ public ip address | |
# will not be listed in the inventory until You set: | |
vpc_destination_variable = private_ip_address | |
#vpc_destination_variable = ip_address |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: test connection | |
ping: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Creates ssh directory | |
file: | |
path: ~/.ssh/ | |
state: directory | |
- name: Create ssh config file in local computer | |
copy: | |
dest: ~/.ssh/config | |
content: | | |
Host 10.*.*.* | |
User ubuntu | |
IdentityFile XXXXX.pem | |
StrictHostKeyChecking=no | |
ProxyCommand ssh -q -W %h:%p {{ lookup('env', 'IP') }} | |
Host {{ lookup('env', 'IP') }} | |
User ubuntu | |
StrictHostKeyChecking=no | |
IdentityFile XXXXX.pem | |
ForwardAgent yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment