简体   繁体   中英

using Ansible for netstat command and format on playbook

Using ansible to run a nestat command and then using grep to get an IP address

but when it runs throught the playbook it hard to read off of terminal. Looks like the format is off but also the IP address isnt coming back.

I have tested the command on the server of choice and it does what its meant to do

 - name: netstat check
       command: netstat -tulnp | awk grep -e 'PADDRESS HERE'
       register: netstat
 - debug: msg="{{netstat.stdout}}"

Any help would be amazing

您可以尝试如下获取格式正确

- debug: msg="{{netstat.stdout_lines}}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM