Accessing values from cfg/ini file and using that in playbook

15 views
Skip to first unread message

Akshay Kumar

unread,
Oct 19, 2020, 8:56:37 AM10/19/20
to Ansible Development
Hi Team,

I am trying to do the following , would appreciate if someone has a better idea to workout for the scenario:

Cfg file-----

Section1:
  ls:
    first:
      DirName:  /home/kumar/DevFileLocation
      User:     kumar
Section2:
  rm:
    first:
      DirName:  /home/kumar/DevFileLocation
      User:     kumar

for this cfg i want to write playbook which will pick up data form cfg file and run list command in the playbook task.

Thanks

Kelly Brazil

unread,
Oct 19, 2020, 10:21:40 AM10/19/20
to Akshay Kumar, Ansible Development
Hi Akshay,

The jc filter in the community.general collection can turn INI and YAML files into objects you can use in your playbooks. 

https://blog.kellybrazil.com/2020/08/30/parsing-command-output-in-ansible-with-jc/

Kelly

On Oct 19, 2020, at 5:56 AM, Akshay Kumar <aksha...@gmail.com> wrote:

Hi Team,
--
You received this message because you are subscribed to the Google Groups "Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-devel/926c5d4d-3951-4d08-af68-5e0b093a85d5n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages