ansible_xlsx_inventory icon indicating copy to clipboard operation
ansible_xlsx_inventory copied to clipboard

Expected key=value host variable assignment, got: json

Open rudimocnik opened this issue 4 years ago • 1 comments

Hi

I am playing with your example files and I am getting mixed results. Some executions work and others do not. Is your excel "hard coded" to only accept certain combinations of columns? Can't I use for example, group by Sheet2 column B and host column Sheet 2 column E. If I do that I get an error however, if I follow the example in the description I don't.

I installed the requirements.txt in the venv environment and ran 2 commands.

  1. ./xlsx_inventory.py --config --file example.xlsx --hostname-col A --group-by-col B --sheet Sheet1 I get a Key Error! Is the sheet name setting correct? The config file looks correct tho so I continued.

  2. ansible-inventory -i xlsx_inventory.py --list --yaml --output myinv.yml I get this: Inventory script had an execution error: Expected key=value host variable assignment, got json.

I want to be able to use any sheet and column for in the config file.

Thanks Rudi

rudimocnik avatar Sep 14 '20 14:09 rudimocnik

It seems that if I change A inside cfg file "hostname_col = A" to something else like "hostname_col = B" the script breaks. However, I can choose any column for group_by_col abd sheet variable in the cfg file.

rudimocnik avatar Sep 15 '20 07:09 rudimocnik