Monday, December 10, 2018

Ansible is so useful - Even for someone who doesn't know how to use it!

I love Ansible!  It is so useful even though my skills with it are very minimal, it is so powerful and useful.  I have about 80 or 90 playbooks that I use over and over.  They're all pretty simple but they get things done.  I forget when and where I can use ad-hoc ansible commands.  I love it when those work though.  I thought I could use ad-hoc to view /etc/resolv.conf and goofed around with -shell and had no success.  Then I found this I had written 13 months ago:

- hosts: all
  sudo: yes
  tasks:
  - name: Display /etc/resolv.conf
    shell: cat /etc/resolv.conf
    register: resolv

  - name: Debug resolv
    debug: var=resolv

  - name: Debug resolv.stdout as part of a string
    debug: msg=`{{ resolv.stdout }}`




No comments: