Hi,

It’s probably the syntax you are using only works in visual studio for
“project source” I would expect it to be the ansible syntax and config for
ansible inventory and not visual studio

Here’s the reference:
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html

https://docs.ansible.com/ansible/latest/inventory_guide/intro_dynamic_inventory.html#intro-dynamic-inventory

https://docs.ansible.com/ansible/latest/cli/ansible-inventory.html


-i, --inventory, --inventory-file
<https://docs.ansible.com/ansible/latest/cli/ansible-inventory.html#cmdoption-ansible-inventory-i>

specify inventory host path or comma separated host list. –inventory-file
is deprecated

https://www.digitalocean.com/community/tutorials/how-to-set-up-ansible-inventories


Regards,
S.W

On Mon, 9 Jan 2023 at 16:24, Chris Condon <[email protected]>
wrote:

> I'm trying to create my inventory from WSUS. For me there are advantages
> in terms of capturing physical servers that aren't in vCenter.
>
> I am mostly there. On the WSUS server I have a PowerShell script that
> exports the list of servers in WSUS to INI and YML files that Ansible can
> understand. I have a script that uploads the files to Ansible. However,
> when I tried to use either file as a souce "from poject" it can't find them.
>
> I tried creating the inventory/wsusfiles/ folder and the inventory files
> in Visual Studio, and those are found as an inventory source just fine. But
> clearly when I am uploading the files into what seems to be that folder, it
> isn't really going there (I added a dummy server name to the upload file to
> confirm and it didn't appear in inventory when I resynced the inventory
> file).
>
> So, my questions are:
>
> Where am I really uploading to within the project, and it is possible to
> reference that path as the inventory source? Or is the only way to update
> the source to modify the file in Visual Studio and sync?
>
> Is there some other source other than "Sourced from Project" I can use to
> make this work? It seems like "import from file" should be basic
> functionality, but if I can't use a file I upload I'm kind of stuck.
>
> Thanks!
>
> Upload file:
>
> ---
> - name: pull inventory
>   hosts: all
>   become: false
>   vars:
>     myfile_json: 'D:\batch\wsuslist\dothosts.json'
>     myfile_txt: 'D:\batch\wsuslist\dothosts.txt'
>     myfile_yml: 'D:\batch\wsuslist\dothosts.yml'
>     myfile_ini: 'D:\batch\wsuslist\dothosts.ini'
>     dump_dir: "/inventory/wsusfiles/"
>   tasks:
>     - name: fetch file json
>       ansible.builtin.fetch:
>         src: "{{ myfile_json }}"
>         dest: "{{ dump_dir }}"
>         flat: yes
>     - name: fetch file txt
>       ansible.builtin.fetch:
>         src: "{{ myfile_txt }}"
>         dest: "{{ dump_dir }}"
>         flat: yes
>     - name: fetch file yml
>       ansible.builtin.fetch:
>         src: "{{ myfile_yml }}"
>         dest: "{{ dump_dir }}"
>         flat: yes
>     - name: fetch file ini
>       ansible.builtin.fetch:
>         src: "{{ myfile_ini }}"
>         dest: "{{ dump_dir }}"
>         flat: yes
>
> Inventory source:
>
> Sourced from Project
> Inventory file: /inventory/wsusfiles/dothosts.ini
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/69d65cda-af8e-41f9-990b-2b7ffaf62a92n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/69d65cda-af8e-41f9-990b-2b7ffaf62a92n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAACV%3DNkh6p6mUD_53DrfR6zJx3h5jtavz7tZh8%3DGK_6dpE10fw%40mail.gmail.com.

Reply via email to