Re: [ansible-project] Extract nmon

2021-12-28 Thread Dick Visser
Then your privilege escalation is not set up correctly. You should fix
that.
But since you just mention the opaque "throwed me error" it's mostly a
guess.



On Wed, 29 Dec 2021 at 07:26, Kannappan M  wrote:

> Hi all,
> From my ansible user I was trying to fetch the nmon files (root owned) but
> throwed me error even though I have mentioned as become: yes. Now if I run
> the same playbook using root user ,my task is getting completed but I need
> to perform this task using ansible user not as root user.
>
> On Tue, Dec 28, 2021, 22:11  wrote:
>
>> ansible-project@googlegroups.com
>> 
>>  Google
>> Groups
>> 
>> 
>> Today's topic summary
>> View all topics
>> 
>>
>>- Need to understand how I can write a ansible role so that it
>>compares input / output value.
>><#m_241710674093759_m_-1182577969097162148_group_thread_0> - 2
>>Updates
>>- ActiveState of a systemd service
>><#m_241710674093759_m_-1182577969097162148_group_thread_1> - 8
>>Updates
>>- Ansible command output
>><#m_241710674093759_m_-1182577969097162148_group_thread_2> - 1
>>Update
>>
>> Need to understand how I can write a ansible role so that it compares
>> input / output value.
>> 
>> Marian Saldhana : Dec 27 08:58PM -0800
>>
>> Hi All,
>>
>> This is my code:
>>
>> ---
>> # tasks file for uname
>>
>> - name: Kernel version number
>> register: uname_a
>> command: "uname -a"
>>
>> - debug:
>> var: ...more
>> 
>> Mauricio Tavares : Dec 28 07:35AM -0500
>>
>> var
>>
>> On Mon, Dec 27, 2021 at 11:58 PM Marian Saldhana
>> > }
>>
>> > 
>>
>> > Now I need to compare these values with the values given by the
>> customer ( Linux ansible-client1 4.18.0-348.el8.x86_64 ) ...more
>> 
>> Back to top <#m_241710674093759_m_-1182577969097162148_digest_top>
>> ActiveState of a systemd service
>> 
>> Todd Lewis : Dec 27 08:53AM -0800
>>
>> You probably want something like this:
>>
>> - hosts: localhost
>> tasks:
>> - name: Get Service Status
>> ansible.builtin.systemd:
>> name: '{{ item }}.service'
>> register: hello
>> loop: ...more
>> 
>> Todd Lewis : Dec 27 08:55AM -0800
>>
>> which produces:
>> TASK [Dump ActiveState] **
>> ok: [localhost] => {
>> "msg": [
>> {
>> "name": "postfix.service",
>> "state": "active"
>> },
>> { ...more
>> 
>> Dick Visser : Dec 27 09:07PM +0100
>>
>>
>> > - debug:
>> > msg: "{{ hello.results | to_nice_json |
>> > json_query('status.ActiveState') }}"
>>
>> the result var is a list, so if you want a list of a specific key:
>>
>>
>> - debug: ...more
>> 
>> Thomas Stephen Lee : Dec 28 08:00AM +0530
>>
>> Hi @Todd Lewis,
>>
>> That works.
>>
>> Thanks a lot.
>>
>> ---
>> Lee
>>
>> ...more
>> 
>> Thomas Stephen Lee : Dec 28 08:00AM +0530
>>
>> Hi @Dick Visser,
>>
>> That gives the below output.
>>
>> -%<-
>>
>> TASK [debug]
>> ***
>> ok: [localhost] => { ...more
>> 
>> Dick Visser : Dec 28 12:26PM +0100
>>
>> I meant:
>>
>> - debug: var=hello|json_query('results[].status.ActiveState')
>>
>>
>>
>> --
>> Dick Visser
>> Trust & Identity Service Operations Manager
>> GÉANT
>> ...more
>> 
>> Thomas Stephen Lee : Dec 28 05:27PM +0530
>>
>> Hi @Dick Visser,
>>
>> That gives the below output.
>>
>> -%<-
>>
>> TASK [debug]
>> ***
>> ok: [localhost] => { ...more
>> 
>> Dick Visser : Dec 28 01:29PM +0100
>>
>> I believe this is what you wanted - right?
>>
>>
>>

[ansible-project] Extract nmon

2021-12-28 Thread Kannappan M
Hi all,
>From my ansible user I was trying to fetch the nmon files (root owned) but
throwed me error even though I have mentioned as become: yes. Now if I run
the same playbook using root user ,my task is getting completed but I need
to perform this task using ansible user not as root user.

On Tue, Dec 28, 2021, 22:11  wrote:

> ansible-project@googlegroups.com
> 
>  Google
> Groups
> 
> 
> Today's topic summary
> View all topics
> 
>
>- Need to understand how I can write a ansible role so that it
>compares input / output value. <#m_-1182577969097162148_group_thread_0>
>- 2 Updates
>- ActiveState of a systemd service
><#m_-1182577969097162148_group_thread_1> - 8 Updates
>- Ansible command output <#m_-1182577969097162148_group_thread_2> - 1
>Update
>
> Need to understand how I can write a ansible role so that it compares
> input / output value.
> 
> Marian Saldhana : Dec 27 08:58PM -0800
>
> Hi All,
>
> This is my code:
>
> ---
> # tasks file for uname
>
> - name: Kernel version number
> register: uname_a
> command: "uname -a"
>
> - debug:
> var: ...more
> 
> Mauricio Tavares : Dec 28 07:35AM -0500
>
> var
>
> On Mon, Dec 27, 2021 at 11:58 PM Marian Saldhana
> > }
>
> > 
>
> > Now I need to compare these values with the values given by the customer
> ( Linux ansible-client1 4.18.0-348.el8.x86_64 ) ...more
> 
> Back to top <#m_-1182577969097162148_digest_top>
> ActiveState of a systemd service
> 
> Todd Lewis : Dec 27 08:53AM -0800
>
> You probably want something like this:
>
> - hosts: localhost
> tasks:
> - name: Get Service Status
> ansible.builtin.systemd:
> name: '{{ item }}.service'
> register: hello
> loop: ...more
> 
> Todd Lewis : Dec 27 08:55AM -0800
>
> which produces:
> TASK [Dump ActiveState] **
> ok: [localhost] => {
> "msg": [
> {
> "name": "postfix.service",
> "state": "active"
> },
> { ...more
> 
> Dick Visser : Dec 27 09:07PM +0100
>
>
> > - debug:
> > msg: "{{ hello.results | to_nice_json |
> > json_query('status.ActiveState') }}"
>
> the result var is a list, so if you want a list of a specific key:
>
>
> - debug: ...more
> 
> Thomas Stephen Lee : Dec 28 08:00AM +0530
>
> Hi @Todd Lewis,
>
> That works.
>
> Thanks a lot.
>
> ---
> Lee
>
> ...more
> 
> Thomas Stephen Lee : Dec 28 08:00AM +0530
>
> Hi @Dick Visser,
>
> That gives the below output.
>
> -%<-
>
> TASK [debug]
> ***
> ok: [localhost] => { ...more
> 
> Dick Visser : Dec 28 12:26PM +0100
>
> I meant:
>
> - debug: var=hello|json_query('results[].status.ActiveState')
>
>
>
> --
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
> ...more
> 
> Thomas Stephen Lee : Dec 28 05:27PM +0530
>
> Hi @Dick Visser,
>
> That gives the below output.
>
> -%<-
>
> TASK [debug]
> ***
> ok: [localhost] => { ...more
> 
> Dick Visser : Dec 28 01:29PM +0100
>
> I believe this is what you wanted - right?
>
>
> --
> Dick Visser
> Trust & Identity Service Operations Manager
> GÉANT
> ...more
> 
> Back to top <#m_-1182577969097162148_digest_top>
> Ansible command output
> 
> Dick Visser : Dec 27 09:31PM +0100
>
> Why would you want to use ansible for this?
> What is the use case