Re: [ansible-project] Ansible writing to a file

2021-03-09 Thread 'Chris Bidwell' via Ansible Project
Thanks for the update, however, it looks like it's not using the sudoer I'm 
wanting it to use.  I have become: yes up top which I would think would run 
as the sudoer user I'm intending.  

If I'm trying to run this playbook in my homedir which is where all my 
others are initiated from and added become: yes and knowing that the sudoer 
user is listed in my ansible.cfg file, it doesn't seem to be running as 
that.



On Wednesday, March 3, 2021 at 10:38:29 PM UTC-7 rajthecomputerguy wrote:

> looks like you have missed " delegate_to: localhost" in first task.
>
> On Thu, Mar 4, 2021 at 4:47 AM 'Chris Bidwell - NOAA Federal' via Ansible 
> Project  wrote:
>
>> Hi all,
>>
>> So I'm trying to write to a local file from my ansible server based off 
>> information I've gotten from my inventory hosts.  For some reason, it keeps 
>> creating the file ON the inventory host instead of my ansible server.  Here 
>> is my playbook:
>>
>> ---
>> - hosts: ALL_LINUX
>>   become: yes
>>   vars_files:
>> - vars.yml
>>   
>>   vars:
>> - SVR: "rhel.svr"
>> - WKSTN: "rhel.wkstn"
>>
>>   tasks:
>> - name: Make sure files exist
>>   file:
>> path: "{{ item }}"
>> state: touch
>>   with_items:
>> - "{{ SVR }}"
>> - "{{ WKSTN }}"
>>
>> - name: Zero out files
>>   shell: cat /dev/null > "{{ item }}"
>>   with_items:
>> - "{{ SVR }}"
>> - "{{ WKSTN }}"
>>   delegate_to: localhost
>> 
>> - name: Workstation or Server?
>>   shell: cat /etc/redhat-release | awk '{print $5}'
>>   register: rh_type
>>   tags: name
>>
>> - name: "Find rhel servers"   
>>   lineinfile: 
>> dest: "{{ SVR }}"
>> line: "{{ inventory_hostname }}"
>> create: yes   
>> insertafter: EOF  
>>   delegate_to: localhost  
>>   when: rh_type.stdout == "Server"
>>   with_items: "{{ ansible_play_hosts }}"
>>
>> - name: "Find rhel workstations"   
>>   lineinfile: 
>> dest: "{{ WKSTN }}"
>> line: "{{ inventory_hostname }}"
>> create: yes   
>> insertafter: EOF  
>>   delegate_to: localhost  
>>   when: rh_type.stdout == "Workstation"
>>   with_items: "{{ ansible_play_hosts }}"
>>
>> -- 
>> 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-proje...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/CAHKi8CgrQ9KZoT1ViiPBuAr7UrwuUQ54DZc%3DDSnbZq3-Q7M%2B4Q%40mail.gmail.com
>>  
>> 
>> .
>>
>
>
> -- 
>
> Thanks,
>
> Pushparaj G
>
>

-- 
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/d4ff17b8-bffa-4b3b-bdd3-4e9ba8ce889en%40googlegroups.com.


Re: [ansible-project] Running yum updates with ansible

2019-01-29 Thread 'Chris Bidwell' via Ansible Project
Using the latest of 2.7.

On January 28, 2019 4:06:55 PM MST, Jonathan Lozada De La Matta 
 wrote:
>what version of ansible are you using?
>
>On Mon, Jan 28, 2019 at 6:02 PM 'Chris Bidwell - NOAA Federal' via
>Ansible
>Project  wrote:
>
>> Hey all,
>>
>> So I've done a lot of yum updates with ansible and several times I
>get
>> issues where partial updates are run and it says it's been completed,
>> however, I reboot and I'm in a kernel panic because the new kernel
>didn't
>> update properly so I have to revert to the previous kernel and remove
>the
>> newest and reinstall it again.  I also often wind up with
>transactions that
>> haven't been completed.Has anyone experienced this before?
>>
>> Thanks!
>> Chris
>>
>> --
>> 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 post to this group, send email to
>ansible-project@googlegroups.com.
>> To view this discussion on the web visit
>>
>https://groups.google.com/d/msgid/ansible-project/CAHKi8CgQ87cs0toXZ4pqefZjoA_Yv0mc89DcMLYih7j6nVHgew%40mail.gmail.com
>>
>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>-- 
>
>Jonathan lozada de la matta
>
>AUTOMATION PRACTICE
>
>-- 
>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 post to this group, send email to ansible-project@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/ansible-project/CAFYJA%2B%2B2Zrfn5pS4fudigASZGm35VaMUxAzZAgQUBDvFBxxLxw%40mail.gmail.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/F667BD03-46CC-4DD0-A752-0B11FC688390%40noaa.gov.
For more options, visit https://groups.google.com/d/optout.