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.