Wednesday, December 7, 2016

Linux One-Liner in YAML (Ansible format)

So the linux config one-liner I posted yesterday.  Here it is in a workable Ansible playbook format:

---
- hosts: all
  name: Run the massive config one-liner
  become: yes
  tasks:
  - shell: set -x; history ; last  -n 666 -a -d -x -F ; who ; uptime ; uptime -p ; cat /etc/red-hat/release ; uname -a ; iptables-save ; netstat -tunap ; ps aufx ; yum list installed ; chkconfig --list ; chkconfig --list | grep on ; cat /etc/passwd ; cat /etc/group ; cat /etc/ssh/ssh_config ; cat /etc/ssh/sshd_config ; cat /root/.ssh/config ; cat /root/.ssh/authorized_keys ; cat /root/.ssh/known_hosts ; cat /home/*/.ssh/known_hosts >> /root/"$HOSTNAME"_"$USER"_`date +%F`.log 2>&1

No comments:

Post a Comment