Is this possible?

133 views
Skip to first unread message

Suporter

unread,
Mar 28, 2017, 2:49:36 PM3/28/17
to Ansible Project
i want to create some reg entries and i want to pull data and value for it from an url..where i can  edit those whenever required and when there is a change there , ansible should pick it and enter that in registry...is it possible? sorry i am new to ansible..

J Hawkesworth

unread,
Mar 29, 2017, 7:49:20 AM3/29/17
to Ansible Project

There are a lot of options here.

I suggest you try to create a playbook and then ask specific questions when you find part of it that you can't get working.

All the best,

Jon

Suporter

unread,
Mar 29, 2017, 8:44:46 AM3/29/17
to Ansible Project
the problem is i dont even know the existence of such options :(

J Hawkesworth

unread,
Mar 29, 2017, 7:06:30 PM3/29/17
to Ansible Project
Sounds like you might do well to read about win_regedit module, win_regnerge module, creating templates, and possibly ansible-pull.

A description of the problem you are trying to solve might help others make some more specific suggestions.

Jon

Suporter

unread,
Mar 30, 2017, 4:21:44 AM3/30/17
to Ansible Project
---
 - hosts: web
   tasks:
    - name: Create and add reg entries
      win_regedit:
       path: HKLM:\SOFTWARE\myapp\Desk\Test
       entry: "{{ item }}"
       data: world
       type: string
       state: present
      with_items:
         - hello
         - hi


This is the sample playbook, here i am creating a reg key called "test" under HKLM:\SOFTWARE\myapp\Desk\ and i am adding 2 entries with items called hello and hi and i am assigning single same value "world" to both hello and hi.

i want to get the value for hello and hi from some file which will be stored in a repository or some url ..the value will be different for hello and hi ...i hope you got what i am trying to achieve

On Wednesday, March 29, 2017 at 12:19:36 AM UTC+5:30, Suporter wrote:

Suporter

unread,
Mar 31, 2017, 10:55:43 PM3/31/17
to Ansible Project
Ping...any replies on how can i achieve this?


On Wednesday, March 29, 2017 at 12:19:36 AM UTC+5:30, Suporter wrote:

Suporter

unread,
Apr 2, 2017, 2:13:00 PM4/2/17
to Ansible Project
is the forum alive? i can see most of the questions unanswered...


On Wednesday, March 29, 2017 at 12:19:36 AM UTC+5:30, Suporter wrote:

Jordan Borean

unread,
Apr 2, 2017, 5:04:42 PM4/2/17
to Ansible Project
The group is still alive, you would find most people don't work on a weekend hence the unanswered questions. I haven't looked too closely at your code but it seems to be on the right track. yiu have various options around getting file contents such as using slurp to retrieve the contents of a file on the remote host but you would probably be better off using a lookup or filter on the control host http://docs.ansible.com/playbooks_lookups.html and http://docs.ansible.com/playbooks_filters.html. Lookups only work for files on the control hosts but it gives you options such as parsing an ini file. Ultimately you will have to piece together how to do this as it is your process but I would try to keep in mind if you can change your process to suit your tools more, I.e store the key value reg changes in ansible group vars so your changes are automatically available.

Suporter

unread,
Apr 3, 2017, 1:46:20 AM4/3/17
to Ansible Project

i dont really know where the head and tail is , a simple example would help me

On Wednesday, March 29, 2017 at 12:19:36 AM UTC+5:30, Suporter wrote:

Suporter

unread,
Apr 3, 2017, 8:43:03 AM4/3/17
to Ansible Project
a bit of improvement 

---
 - hosts: web
   tasks:
    - name: Create and add reg entries
      win_regedit:
       path: HKLM:\SOFTWARE\myapp\Desk\Test
       entry: "{{ item.regkey }}"
       data: "{{ item.regvalue}}"
       type: string
       state: present
      with_items:
         - regkey: hello
           regvalue: world
         - regkey: hi
           regvalue: universe

but, i want to fetch regkey as well as regvalue from a url...i.e i want to create a file with details like hello:world, hi:universe and i want ansible to take left side as keys and right side as values and create reg entries and store the values...

On Wednesday, March 29, 2017 at 12:19:36 AM UTC+5:30, Suporter wrote:

Suporter

unread,
Apr 4, 2017, 3:12:00 AM4/4/17
to Ansible Project
Any replies would be appreciated


On Wednesday, March 29, 2017 at 12:19:36 AM UTC+5:30, Suporter wrote:

J Hawkesworth

unread,
Apr 4, 2017, 5:53:49 AM4/4/17
to Ansible Project
Have a look at the 'uri' module - you can use that to fetch the contents of a .json or .yml file and then register the results from the uri response and use the response values in your call to win_regedit.

Bear in mind the uri module will need to run on the controller, so use 'delegate_to: localhost' for the uri task.

Hope this helps,

Jon
Reply all
Reply to author
Forward
0 new messages