[ansible-devel] wait_for -> check for no moving logs, and skip string "Consul Health Check"

2019-08-29 Thread Denny Fuchs
hi,

at the moment we use something like:

  - name: wait for possible traffic
shell: "tail -n 5 /var/log/nginx/ssl-*access*log"
register: watch_nginx_log
retries: 30
delay: 5
until: "watch_nginx_log.stdout_lines | reject('search','nginx_status') 
| list | count == 0"
when: zero_weight is defined




The goal is to search, if there is _any_ string in the Nginx log file, but 
drop/skip the nginx_status, which comes from a Consul health check. So, if 
there is any other string, "wait_for" should "wait" and counting, until 
there is no other lines and then do the next part. An example logfile with 
no other strings looks like:


172.16.1.4 - - [29/Aug/2019:08:43:22 +0200] "GET /nginx_status HTTP/1.1" 
200 111 "-" "Consul Health Check"
172.16.1.4 - - [29/Aug/2019:08:43:42 +0200] "GET /nginx_status HTTP/1.1" 
200 111 "-" "Consul Health Check"
172.16.1.4 - - [29/Aug/2019:08:44:02 +0200] "GET /nginx_status HTTP/1.1" 
200 111 "-" "Consul Health Check"
172.16.1.4 - - [29/Aug/2019:08:44:22 +0200] "GET /nginx_status HTTP/1.1" 
200 111 "-" "Consul Health Check"
172.16.1.4 - - [29/Aug/2019:08:44:42 +0200] "GET /nginx_status HTTP/1.1" 
200 111 "-" "Consul Health Check"
172.16.1.4 - - [29/Aug/2019:08:45:02 +0200] "GET /nginx_status HTTP/1.1" 
200 111 "-" "Consul Health Check"



I want to replace it with a more Ansible way. I found, that there is a 
"wait_for" with search_regex. Is it possible ? I have to do the same with a 
squid access.log :-)

cu denny

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/6ae49b6c-760e-41ea-8696-950f49503101%40googlegroups.com.


Re: [ansible-devel] Why is "datacenter" a required parameter for vmware modules?

2019-08-29 Thread Kai Stian Olstad
On 28.08.2019 16:48, MKPhil wrote:
> That's not a datacenter issue - you can have two VMs with the same name in
> the same datacenter but VMWare does not recommend this -
> https://kb.vmware.com/s/article/2108769

I would say it is.
A datacenter is a namespace that makes it possible to have the same name for 
VMs, templates, hosts, clusters, networks and datastores across datacenters. 
But must of them need to be uniq within the datacenter.


> vmware_guest_facts has a "name_match" parameter "If multiple virtual
> machines matching the name, use the first or last found." (see
> https://docs.ansible.com/ansible/latest/modules/vmware_guest_facts_module.html#vmware-guest-facts-module)
> to cater for this but in my opinion (I support over 20,000 vms), you should
> probably really aim to have unique names.

IMHO it's missing the option fail.


-- 
Kai Stian Olstad

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-devel/5eaa1209-9725-e27c-84f4-c8c1ecbb66a6%40olstad.com.