Revision b9954290 gen-config.py

View differences:

gen-config.py
15 15
parser.add_argument("-s", "--ssh-config", dest="ssh_config",
16 16
                    default="ssh-config", action="store", metavar="FILENAME",
17 17
                    help="Output file onto which the SSH configuration is "
18
                         "written")
18
                         "written (default=%(default)s)")
19 19
parser.add_argument("-a", "--ansible-config", dest="ansible_config",
20 20
                    default="ansible.cfg", action="store", metavar="FILENAME",
21 21
                    help="Output file onto which the ansible configuration is "
22
                         "written")
22
                         "written (default=%(default)s)")
23 23
parser.add_argument("-i", "--inventory", dest="ansible_inventory",
24 24
                    default="ansible-hosts", action="store", metavar="FILENAME",
25 25
                    help="Output file onto which the ansible inventory is "
26
                         "written")
26
                         "written (default=%(default)s)")
27
parser.add_argument("-k", "--key", dest="identity",
28
                    default=IDENTITY_FILE, action="store",
29
                    metavar="FILENAME",
30
                    help="Private key or certificate used for the "
31
                         "authentication (default=%(default)s)")
27 32

  
28 33
args = parser.parse_args()
29 34

  
......
35 40
ssh_config_file = args.ssh_config
36 41
ansible_config_file = args.ansible_config
37 42
ansible_inventory_file = args.ansible_inventory
43
identity_file = args.identity
38 44

  
39 45
config_file = open(ssh_config_file, "w")
40 46
ansible_file = open(ansible_config_file, "w")
41 47
inventory_file = open(ansible_inventory_file, "w")
42 48

  
43
ssh_config = SSHConfig(SSH_CONFIG_TEMPLATE, HOST_CONFIG_TEMPLATE, IDENTITY_FILE)
49
ssh_config = SSHConfig(SSH_CONFIG_TEMPLATE, HOST_CONFIG_TEMPLATE, identity_file)
44 50
ansible_config = AnsibleConfig(ANSIBLE_CONFIG_TEMPLATE,
45 51
                               INVENTORY_CONFIG_TEMPLATE,
46
                               ANSIBLE_HOST_TEMPLATE, IDENTITY_FILE,
52
                               ANSIBLE_HOST_TEMPLATE, identity_file,
47 53
                               ansible_inventory_file, ssh_config_file)
48 54

  
49 55
xml_file = ET.iterparse(rspec_file)

Also available in: Unified diff