Dang! Thank you! On Wed, Sep 29, 2021 at 2:15 PM Matt Martz <m...@sivel.net> wrote:
> Your output doesn't match the provided play, however, I'm guessing you > need a `become: no` on the task that has `delegate_to: localhost` on it. > > On Wed, Sep 29, 2021 at 3:13 PM 'Chris Bidwell - NOAA Federal' via Ansible > Project <ansible-project@googlegroups.com> wrote: > >> Hi all! >> >> So this has worked at one point but is no longer. >> >> I'm trying to gather information on each of my rhel clients and write >> that information to one file on my answer server. >> >> Here is my playbook: >> >> --- >> - hosts: 'ALL_LINUX' >> become: yes >> become_method: sudo >> vars_files: >> - passwd.yml >> - vars.yml >> >> vars: >> - RHEL_INV: "/home/chris.bidwell/rhel_inventory" >> - VAR: "{{ hostvars[item].facter_virtual }}" >> >> tasks: >> - name: Workstation or Server? >> shell: cat /etc/redhat-release | awk '{print $5}' >> register: rh_type >> tags: name >> >> - name: Append to file >> lineinfile: >> dest: "{{ RHEL_INV }}" >> line: "{{ ansible_default_ipv4.address }},{{ inventory_hostname >> }},{{ ansible_default_ipv4.macaddress }},{{ansible_distribution }}, {{ >> ansible_distribution_major_version }}, {{ rh_type.stdout }}" >> insertafter: EOF >> create: yes >> delegate_to: localhost >> >> - debug: >> msg: "{{ ansible_default_ipv4.address }},{{ inventory_hostname >> }},{{ ansible_default_ipv4.macaddress }},{{ ansible_distribution }} {{ >> ansible_distribution_major_version }} {{ rh_type.stdout }}" >> with_items: "{{ ansible_play_hosts }}" >> >> Where my output is saying: >> chris.bidwell@atsb-swpc-pup-svr-lx:roles$ ap rhel_inventory.yml -K >> --limit 'rhel8-base-lx' >> BECOME password: >> >> PLAY [ALL_LINUX] >> ********************************************************************************************************************************************************************************************************** >> >> TASK [Gathering Facts] >> **************************************************************************************************************************************************************************************************** >> ok: [rhel8-base-lx] >> >> TASK [Make sure files exist] >> ********************************************************************************************************************************************************************************************** >> >> >> >> *Sorry, try again.failed: [rhel8-base-lx] >> (item=/home/chris.bidwell/rhel.svr) => {"ansible_loop_var": "item", >> "changed": false, "item": "/home/chris.bidwell/rhel.svr", "module_stderr": >> "[sudo via ansible, key=hkjseytyeuvgdyqbndymptpnvkghxbld] password:\nsudo: >> no password was provided\nsudo: 1 incorrect password attempt\n", >> "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the >> exact error", "rc": 1}Sorry, try again.failed: [rhel8-base-lx] >> (item=/home/chris.bidwell/rhel.wkstn) => {"ansible_loop_var": "item", >> "changed": false, "item": "/home/chris.bidwell/rhel.wkstn", >> "module_stderr": "[sudo via ansible, key=vhtrrvzwdhssvgmxrexsvvhxvzyonmeu] >> password:\nsudo: no password was provided\nsudo: 1 incorrect password >> attempt\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr >> for the exact error", "rc": 1}* >> >> PLAY RECAP >> **************************************************************************************************************************************************************************************************************** >> rhel8-base-lx : ok=1 changed=0 unreachable=0 >> failed=1 skipped=0 rescued=0 ignored=0 >> >> -- >> 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 ansible-project+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CAHKi8CgdMkrnAeCarf5S1eJiigr%2B9orVj8RYRq2ttRxF%3DPrOnA%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CAHKi8CgdMkrnAeCarf5S1eJiigr%2B9orVj8RYRq2ttRxF%3DPrOnA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > > > -- > Matt Martz > @sivel > sivel.net > > -- > 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 ansible-project+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAD8N0v-fYJN_wjBKRxL1fQCTDFNJfySkxJq5zw%2BjtV4E54dTrA%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAD8N0v-fYJN_wjBKRxL1fQCTDFNJfySkxJq5zw%2BjtV4E54dTrA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- Chris Bidwell, CISSP Space Weather Prediction Center National Oceanic Atmospheric Administration email: c <cbidw...@usgs.gov>hris.bidw...@noaa.gov office: 303-497-3204 mobile: 720-496-3126 -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAHKi8CgxsoYf3AR5tJgS-pwCvf3dAiZ-_uZ7ufXJHXZt4fi7cA%40mail.gmail.com.