Think it through .. what is the structure of the data in 'lg' after
win_service? You have to learn to decipher structured data so you can learn how
to reference it.
Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123
On Aug 26, 2022, at 12:13 PM, Nitrous
Yes, its the same information I gathered previously.
I need to search for this string in my when condition:
"exists": true
How can I do that?
Thanks
On Friday, August 26, 2022 at 10:59:12 AM UTC-5 walte...@nist.gov wrote:
> Please read the module page for a description of what is "registered"
How can I search for this exact string using my example:
"exists": true
My when condition:
when: lg is search( "exists": true )
It errors out using "exists": true.
On Friday, August 26, 2022 at 9:27:53 AM UTC-5 Nitrous wrote:
> Thanks, but I have other tasks that depend on my when
Thanks, but I have other tasks that depend on my when condition, so I need
to get it right.
On Friday, August 26, 2022 at 9:22:37 AM UTC-5 pgm...@gmail.com wrote:
>
> https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_service_info_module.html
>
> On Fri, Aug 26, 2022 at
https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_service_info_module.html
On Fri, Aug 26, 2022 at 9:17 AM Nitrous wrote:
> Im trying to figure out a way, on how to make a condition exit, if a
> service is running.
> If it isnt running, then install it.
>
> My play book
Im trying to figure out a way, on how to make a condition exit, if a
service is running.
If it isnt running, then install it.
My play book looks like below:
- name: Check if LogRhythm System Monitor service is installed
win_service:
name: lg
register: lg
- ansible.builtin.debug:
On Sat, 29 Jan 2022 05:05:39 -0800 (PST)
John Veliss wrote:
> I would like to include some ansible *"when"* conditions based on if a
> software package is greater than a value ...
Set default to 'undef' if the package is missing, e.g.
- package_facts:
- set_fact:
_version: "{{
I would like to include some ansible *"when"* conditions based on if a
software package is greater than a value, ie when a package is greater than
8.2, perform a task such as stop a service, uninstall the package, copy a
file, install a new version of the package
I have the below which shows
sorry. I take it back my words
the following change is working
when: htop_is_running.stdout == '0'
Thanks
On Friday, October 1, 2021 at 8:05:29 AM UTC-4 ra...@linuxia.de wrote:
> On 01/10/2021 14:53, Sandip Bhattacharya wrote:
> >
> >
> > On 01.10.21 02:10, subbamma natla wrote:
> >> can
On 01.10.21 15:32, subbamma natla wrote:
when: htop_is_running.stdout == '0' did not work
command: pgrep httpd
My question is why the following not working
when: status_httpd.stdout_lines == 0
ok: [mhost1] => {
"status_httpd.stdout_lines": [
"0"
]
}
If the 'when'
when: htop_is_running.stdout == '0' did not work
command: pgrep httpd
My question is why the following not working
when: status_httpd.stdout_lines == 0
ok: [mhost1] => {
"status_httpd.stdout_lines": [
"0"
]
}
Thanks
On Friday, October 1, 2021 at 9:14:27 AM UTC-4 Sandip
What's wrong with asserting that the service should be started?
- systemd:
name: httpd
state: started
For the vast majority of cases that should work (the apache service in major
distros being such a case).
Sometimes you do get an edge case where the PID check in the unit file
On 01/10/2021 14:53, Sandip Bhattacharya wrote:
On 01.10.21 02:10, subbamma natla wrote:
can somebody explaine me why service sis not starting
on mhost1:
[root@mhost1 ~]# ps -ef | grep -v grep | grep httpd
It might be cleaner to use pgrep instead for process check. Then you can use
On 01.10.21 02:10, subbamma natla wrote:
can somebody explaine me why service sis not starting
on mhost1:
[root@mhost1 ~]# ps -ef | grep -v grep | grep httpd
It might be cleaner to use pgrep instead for process check. Then you can use
something like this:
tasks:
- name: Process
can somebody explaine me why service sis not starting
on mhost1:
[root@mhost1 ~]# ps -ef | grep -v grep | grep httpd
[root@mhost1 ~]#
---
- hosts: mhost1
tasks:
- name: check status httpd
shell: ps -ef | grep -v grep | grep httpd|wc -l
register: htop_is_running
notify:
Hello Everyone,
I've a task -
- name: Device Description
uri:
url: "{{ URL }}/api-db?username={{ USERNAME }};password={{
PASSWORD }};cmds=mget+*+{{ display_name }}+sys+SNMPv2-MIB.sysDescr"
validate_certs: no
method: GET
return_content: yes
register: get_descriptions
On 3/19/20 9:22 AM, Uppara venkat wrote:
> Hi all,
>
> I have written below task to copy a file if it is 64-bit windows OS.
>
> - name:
> win_shell: 'wmic os get osarchitecture | findstr "bit"'
> register: result
> - debug: var=result.stdout_lines
>
> - name:
> win_copy:
>
Hi all,
I have written below task to copy a file if it is 64-bit windows OS.
- name:
win_shell: 'wmic os get osarchitecture | findstr "bit"'
register: result
- debug: var=result.stdout_lines
- name:
win_copy:
src='{{package_PATH}}/vim25.zip'
dest='{{ vim25_PATH }}/vmware/'
Hi,
I have yaml file as below. I parse the component and version and put the
parsed value to a file by creating a list
deliveries:
- releases:
- latest:
- tmoAa:
file_name: CXP_902_7801_28.1.0_20191001-024646.tar
md5: f08a50fcb3ec79c87ec870195568826e
product_name:
On Tue, 10 Sep 2019 21:16:04 +0200
Kai Stian Olstad wrote:
> On 10.09.2019 20:14, Vladimir Botka wrote:
> > On Tue, 10 Sep 2019 10:45:45 -0700
> > Guy Knights wrote:
> >
> >> It's possible to define a series of 'and' conditions for a task as follows:
> >>
> >>when:
> >> - foo ==
On 10.09.2019 20:14, Vladimir Botka wrote:
> On Tue, 10 Sep 2019 10:45:45 -0700
> Guy Knights wrote:
>
>> It's possible to define a series of 'and' conditions for a task as follows:
>>
>>when:
>> - foo == true
>> - bar == true
>>
>> As far as I'm aware, the only way to define 'or'
On Tue, 10 Sep 2019 10:45:45 -0700
Guy Knights wrote:
> It's possible to define a series of 'and' conditions for a task as follows:
>
> when:
> - foo == true
> - bar == true
>
> As far as I'm aware, the only way to define 'or' conditions is in-line, as
> such:
>
> when: foo ==
It's possible to define a series of 'and' conditions for a task as follows:
when:
- foo == true
- bar == true
As far as I'm aware, the only way to define 'or' conditions is in-line, as
such:
when: foo == true or bar == true
Is there any other way to define 'or' conditions, in a way
I am using csv python module for importing a csv file
The csv is importing but unable to fetch the values properly.
My main aim is the prompt that takes as server name needs to check from the
csv list whether it exists or not...
I have to add 'when' condition also, but unable to separate
Thanks for the explanation Brian, you are "Awesome". I've used "When & In"
and it worked.
On Monday, April 22, 2019 at 9:20:59 PM UTC-5, Brian Coca wrote:
>
> Mustaches don't stack,
>
> when: ((domainName == "AD1") or (domainName == "AD2")) <= no
> mustaches needed when 'when:', you are
Mustaches don't stack,
when: ((domainName == "AD1") or (domainName == "AD2")) <= no
mustaches needed when 'when:', you are trying to do double
interpolation (conditionals have implicit {{ }})
Also you probably want to use 'in' instead of multiple comparisons:
when: domainName in ["AD1",
Hello,
I am running into an issue, this is simple playbook which tries to copy
right config file based on Domain name, I tried executing below code
snippet it's skipping the non prod and executing prod, Not sure whats wrong
here, can some one throw a light here.
- name: Gathering facts
Thank you, It worked.
On Friday, 1 March 2019 00:50:41 UTC+5:30, Kai Stian Olstad wrote:
>
> On 28.02.2019 13:52, Pandu jh wrote:
> > When Condition check is not working in a list as expected.
> >
> > My requirement is
> >
> > Playbook should not fail If all the three mentioned variables
On 28.02.2019 13:52, Pandu jh wrote:
> When Condition check is not working in a list as expected.
>
> My requirement is
>
> Playbook should not fail If all the three mentioned variables have
> "no_share" value.
> But it's failing not sure what causing this issue.
>
>
>
> - debug:
When Condition check is not working in a list as expected.
My requirement is
Playbook should not fail If all the three mentioned variables have
"no_share" value.
But it's failing not sure what causing this issue.
- debug: var=open_shares_info
- debug: var=linked_dirs_list
-
Hello,
Can some one help me on below issue, When condition got ignored if I use
Includes and loops.
main.yml
---
- name: Run sqlplus command on Target DB server
shell: source ~/.bash_profile && sqlplus -S '{{ admin }}/{{ password
}}@{{ deploy_server }}:1521/{{ oracle_db_name }}'
Hello,
Actually I wrote my playbook this way to set values id the dual variable is
the string value SRV:
- set_fact:
distrib: "{{ distribsrv }}"
Directoryname: "{{ Directorysrv }}"
when: dual == 'SRV'
I would like to modify the when condition to run it when dual == 'SRV1',
Thanks !!
It works, post adding set_fact: current_image_state="{{ image_state.stdout
}}".
On Tue, Feb 7, 2017 at 5:34 PM, Johannes Kastl wrote:
> On 06.02.17 20:00 DHAVAL JAISWAL wrote:
> > Tried below one. However, when condition is not correctly evaluating.
>
> Please show
On 06.02.17 20:00 DHAVAL JAISWAL wrote:
> Tried below one. However, when condition is not correctly evaluating.
Please show the exact error message. Or the exact output, maybe with -v.
> tasks:
>- name: Get the state of the Test version
> shell: alert1=`cat /tmp/test.log | grep -e
Tried below one. However, when condition is not correctly evaluating.
Even following condition true its executing other commands mentioned in
other when condition.
current_image_state <= desire_image_state
tasks:
- name: Get the state of the Test version
shell: alert1=`cat
This should help:
http://docs.ansible.com/ansible/playbooks_variables.html
http://docs.ansible.com/ansible/set_fact_module.html
[]s,
Rodrigo B Brasil
On Wed, Feb 1, 2017 at 4:16 PM, DHAVAL JAISWAL wrote:
> Where i can set this variable so that i can compare it in where
Where i can set this variable so that i can compare it in where condition.
Any small test scenario will help me to understand.
On Mon, Jan 30, 2017 at 11:53 PM, Brian Coca wrote:
> These are not valid variables for Ansible (not since 1.6). Also, setting
> them in a shell
These are not valid variables for Ansible (not since 1.6). Also, setting
them in a shell will not make them available.
when: $numami > $num
--
Brian Coca
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this
I did create the small task. However, for defining variable (num, numami)
in the same task is not working.
e.g
tasks:
- name: Condition statement
shell: date_string=`date +%d%b%G`; num=3; numami=5;
when: $numami > $num
echo Hi;
On Monday, January 30, 2017 at
Just add a when to the tasks you want in the 'if'
when: arg1 > 5
for the 'else' just use the opposite condition.
when: arg1 <=5
--
Brian Coca
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop
I want to use the following condition in ansible playbook.
Scenario is as follows.
If arg1 > 5
follow some steps
else
endif;
IF ELSE is not possible in ansible. However, how can i achive with the WHEN
condition.
--
You received this message because
Hi!
I have a "when: condition that works fine in "regular" tasks, but not in a
handler . . . is that expected?
So I'm using a notify, then at the end of the handler task I have a when
condition. The notification works, but it always triggers, ever when the
condition is false.
Here's the
On 29.04.16 12:08 'Suresh Uppu' via Ansible Project wrote:
> - name: installing python setuptools
> become: yes
> become_method: sudo
> yum: name=python-setuptools state=latest
> when: ansible_os_family == "RedHat"
> zypper: name=python-setuptools state=latest
Hi,
This is Suresh. I am new to Ansible.
I have a query, Can I please ask any one to clarify this.
I am using when: condition.
The below one is working fine.
file copy is working fine based on distribution. didnt get any error.
"
- name: copying clinet install zip to server
become:
Is it possible to write something like when: a and b and c, but get the
list [a,b,c] from a variable?
I have one command that outputs some data, which I register in a variable
x. Then I want to see if all items from variable y are included in that
output. If I were doing it manually, it might
sounds like you mean do something like:
when: a in ['x','y','z']
or
when: x.foo in alist
??
On Fri, Oct 24, 2014 at 3:50 PM, Jacob Weber weberja...@gmail.com wrote:
Is it possible to write something like when: a and b and c, but get the
list [a,b,c] from a variable?
I have one command
Not exactly...I want each condition to be a regex on the output of the original
command (which also contains a lot of other text). That's why I was trying to
use a search filter.
On Oct 24, 2014, at 5:04 PM, Michael DeHaan mich...@ansible.com wrote:
sounds like you mean do something like:
I have a tikitaka3.yml (main yml file) and a tikitaka3a.yml (playbook to be
included) . When I prompt the user for a variable and then in the tasks
section when I call it, like so:
---
- hosts: all
vars:
khan:
# contents: {{ lookup('file',
The when does not affect the include itself, it gets added to all tasks
included.
--
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
Take a look at the docs of the group_by module if you want some more
elegant output based on dynamic criteria.
On Mon, Aug 18, 2014 at 7:44 AM, Brian Coca brianc...@gmail.com wrote:
The when does not affect the include itself, it gets added to all tasks
included.
--
You received this
Basically I want to run my secondary playbook on a specific number of hosts
in a specific group (I have shown just one example of a group here i.e.
umar, I intend on having three groups) using var_prompts, the group is
going to be specified in my main file whereas the logic for particular host
The group_by module?
On Mon, Aug 18, 2014 at 8:42 AM, Imran Khan khan.imran2...@gmail.com
wrote:
Then what can I do to achieve the functionality that I require?
On Monday, August 18, 2014 4:44:18 AM UTC-7, Brian Coca wrote:
The when does not affect the include itself, it gets added to all
Hi Michael,
Thanks ! And second hit bird : I know now what my Debian shell means
by : cannot stat.. Re-thanks. ;)
On 07/18/2014 08:15 PM, Michael DeHaan wrote:
You don't use Jinja2 inside when statements. Further, not all python
functions, including the OS module, are exposed, and what you
Hi,
I would like to evaluate the following condition :
#
- name: Make Debian package
shell: command=make deb chdir=/home/{{ user_installer }}/src/Python.3.4.1
when: os.path.isdir('/home/{{ user_installer }}/src/Python-3.4.1') == True
You don't use Jinja2 inside when statements. Further, not all python
functions, including the OS module, are exposed, and what you are saying
would be an implicit local operation anyway.
You would need to run the stat module, register the result, and use that
- stat: path=/path/to/file
55 matches
Mail list logo