Conditional loop lab


image

My Playbook -


  • hosts: web2
    gather_facts: no
    vars:
    remote_dest: /usr/local/bin/report_status.sh
    tasks:
    • command: sh “{{ remote_dest }}”
      register: test
    • yum: name=bash state=latest

Can someone help me with this when condition what needs to be?

  • name: play1 shell shock play
    hosts: web2
    gather_facts: no
    tasks:
    - name: check shell shock
    shell: ‘/usr/local/bin/report_status.sh’
    register: test

  • name: update bash based on play1
    hosts: web2
    gather_facts: no
    tasks:
    - name: update bash if vulnerable
    yum: name=bash state=latest
    when: “test.stdout.find(‘vulnerable’) == -1”

please indent accordingly.

@domingochavez16 use pre keyword in between <> and closed with same keyword </> (like /pre) or you can use ``` triple this exactly i don’t know name and in the end use same triple this.