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.

The validation for Q7 seems to be broken, and the sample answer is incorrect/incomplete.

---
- hosts: web2
  gather_facts: no
  tasks:
    - name: Run a script
      shell: sh /usr/local/bin/report_status.sh
      register: test
    - debug:
        var: test

Trying to run any playbook gives the following output:

└── ansible-0510-conditionals
    └── cleanup
    
--> Scenario: 'ansible-0510-conditionals'
--> Action: 'cleanup'
ERROR! playbooks must be a list of plays
ERROR: