You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Hi All
I was running an apt_update task and only wanted the server to reboot when it it saw neither of the two lines. Now, what is happening it only sees the first "test" I put in the when: section and ignores the second string to test. The reason for the two tests is I noticed that Debian and Ubuntu have different lines for when they have nothing to update.
I know Ive done something stupid....
- name: Run Apt update safe
command: sudo apt_upgrade_safe
register: apt_update
- name: Reboot Server
#command: sudo reboot
command: echo "test"
when: "'0 to upgrade, 0 to newly install' or '0 upgraded, 0 newly installed' not in apt_update.stdout"
register: reboot
matthew...@learnosity.com
unread,
Mar 21, 2016, 6:06:16 AM3/21/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
I have also tried
"( '0 to upgrade, 0 to newly install' not in ruby_installed_version.stdout) or ( '0 upgraded, 0 newly installed' not in ruby_installed_version.stdout)"
maybe I missed something.... or there is a better way to test for this... :/
matthew...@learnosity.com
unread,
Mar 21, 2016, 5:51:16 PM3/21/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
This seemed to fix my issue but not sure if this is the way I should do it... any feedback would be lovely
when:
- ('0 upgraded, 0 newly installed' not in apt_update.stdout)
- ('0 to upgrade, 0 to newly install' not in apt_update.stdout)
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ansible...@googlegroups.com
seems like you wanted:
when: "( '0 to upgrade, 0 to newly install' not in ruby_installed_version.stdout) and ( '0 upgraded, 0 newly installed' not in ruby_installed_version.stdout)"