Create a playbook /home/bob/ansible/timesync.yml that runs on hosts in the webservers host group and does the following:
1.
Uses the timesync RHEL system role.
2.
Sets the ntp server to 0.uk.pool.ntp.org
3.
Sets the timezone to UTC
Create a file called specs.empty in home/bob/ansible on the local machine as follows:
HOST= MEMORY= BIOS= VDA_DISK_SIZE= VDB_DISK_SIZE=
Create the playbook /home/bob/ansible/specs.yml which copies specs.empty to all remote nodes' path/root/specs.txt. Using the specs.yml playbook then edit specs.txt on the remote machines to reflect the appropriate ansible facts.
Install and configure ansible
User bob has been created on your control node. Give him the appropriate permissions on thecontrol node. Install the necessary packages to run ansible on the control node.
Create a configuration file /home/bob/ansible/ansible.cfg to meet the following requirements:
1.
The roles path should include /home/bob/ansible/roles, as well as any otherpath that may be required for the course of the sample exam.
2.
The inventory file path is /home/bob/ansible/inventory.
3.
Ansible should be able to manage 10 hosts at a single time.
4.
Ansible should connect to all managed nodes using the bobuser. Create an inventory file for the following five nodes:
1.
node1.example.com
2.
node2.example.com
3.
node3.example.com
4.
node4.example.com
5.
node5.example.com
Configure these nodes to be in an inventory file where node1 is a member of group dev. nodc2 is a member of group test, nodc3 is a member of group proxy, nodc4 and node 5 are members of group prod. Also, prod is a member of group webservers.
Which is the default inventory file used by Ansible?
A. ${PWD}/.inventory
B. /etc/hosts
C. /etc/ansible/inventory
D. /etc/ansible/hosts
Consider the following playbook.
-hosts: local become: yes
tasks:
-name: create users user: name: "{{item}}" with_items:
-sam
-john
-bob How many times is the user module invoked?
A. 5
B. 3
C. 1
D. 0
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?
A. ansible-playbook /home/ansible/web.yml
B. ansible-playbook /home/ansible/web.yml --skip-tags web
C. ansible-playbook /home/ansible/web.yml --skip-tags content
D. ansible-playbook /home/ansible/web.yml --tags content
Which line instructs ansible to install httpd?
A. yum: name=httpd state=installed
B. tasks: install httpd
C. service: name=httpd state=installed
D. name: service=httpd state=installed
State whether the following statement is true or false.
Is this the correct format for an ansible ad-hoc command?
ansible servers -m ping
A. True
B. False
State whether the following statement is true or false.
The command ansible-galaxy init won't create the file structure you need for roles.
A. True
B. False
State whether the following statement is true or false.
The following is allowed in a playbook.
-
tasks:
yaml:
name=yum.
-
hosts: local
A.
True
B.
False