Created
May 30, 2020 01:55
-
-
Save alphajc/737357b9a5dda0642f8885a14e81bdae 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
#!/usr/bin/env python | |
import sys | |
import pandas as pd | |
df = pd.read_csv(sys.argv[1]) | |
last = '' | |
for row in df[df['Vpc名称'].notna()][df['主IPv4公网IP'].notna()].sort_values(by=['Vpc名称']).iterrows(): | |
if last != row[1]['Vpc名称']: | |
print() | |
print('[' + row[1]['Vpc名称'] + ']') | |
last = row[1]['Vpc名称'] | |
print(row[1]['ID'], 'ansible_host=' + row[1]['主IPv4公网IP'], '\t#', row[1]['实例名'], row[1]['主IPv4内网IP']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment