You are probably best off using a flat text file for this as Ansible can't
natively parse Excel files. A very basic (can't guarantee to work) example
of using JSON for this would be
JSON File:
[
{
"path": "HKLM:\\Software\\MyCompany",
"name": "hello",
"data": "world"
},
{
"path": "HKLM:\\Software\\MyCompany",
"name": "hi",
"data": "ansible"
}
]
Ansible Tasks:
# If the JSON file is on your Windows box
- name: read remote file
slurp:
src: C:\json_file.txt
register: reg_changes_raw
- name: convert raw slurp to json object
set_fact:
reg_changed: "{{ reg_changes_raw | b64decode | from_json }}"
# If the JSON file in on your Ansible host
- name: read local file
set_fact:
reg_changes: "{{ lookup(file, 'json_file.json') | from_json }}"
# Loop through JSON for win_regedit
- name: win_regedit tasks
win_regedit:
path: "{{item.path}}"
name: "{{item.name}}"
data: "{{item.data}}"
with_items: "{{reg_changes}}"
How you implement this is up to you but if it is the same reg keys you need
to update and it changes only sporadically you should probably just stick
with using the group_vars instead of dealing with external files
On Friday, April 21, 2017 at 2:59:32 PM UTC+10, Suporter wrote:
>
> any help?
>
> On Thursday, April 20, 2017 at 2:01:17 PM UTC+5:30, Suporter wrote:
>>
>> i have an excel file with 2 columns and multiple rows of data, ,
>> basically like a key value pair, i want to import those as it is into
>> win_Regedit for creating registry entries, how can i do it? i want the
>> column1 row1 to be the name in win_regedit and column2 row1 to be the data
>> in win_regedit
>>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c642f11c-3974-4e08-9815-8868cea05da8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.