EX407

EX407 practice questions, page 4 of 4, with answer review and explanations.

Question 16

Consider the following playbook: # playbook name: /home/ansible/web.yml --- - hosts: webservers become: yes tasks: - name: edit file 1 lineinfile: path: /var/www/content.hml line: "{{ text }}" tags: - content - name: edit file 2 lineinfile: path: /var/www/index.hml line: "{{ text }}" tags: - web - name: edit file 3 lineinfile: path: /var/www/etc.hml line: "{{ text }}" tags: - content - misc Which use of the ansible-playbook command on the provided playbook will result in ONLY editing the file /var/www/index.html?

  1. ansible-playbook /home/ansible/web.yml
  2. ansible-playbook /home/ansible/web.yml --skip-tags web
  3. ansible-playbook /home/ansible/web.yml --skip-tags content
  4. ansible-playbook /home/ansible/web.yml --tags content

Question 17

What keyword sets a change condition for a given task?

  1. flag_change
  2. changed_when
  3. register_change
  4. change_set

Question 18

Which line instructs ansible to install httpd?

  1. yum: name=httpd state=installed
  2. tasks: install httpd
  3. service: name=httpd state=installed
  4. name: service=httpd state=installed

Question 19

Which keywords are valid? (Choose all that apply.)

  1. never
  2. rescue
  3. always
  4. block

Question 20

What does the when keyword do?

  1. There is no when keyword
  2. Allows a task to be conditional
  3. Allows a play to be conditional
  4. Allows a play to be scheduled