Create the users in the file usersjist.yml file provided. Do this in a playbook called users.yml located at /home/sandy/ansible. The passwords for these users should be set using the lock.yml file from TASK7. When running the playbook, the lock.yml file should be unlocked with secret.txt file from TASK 7.
All users with the job of 'developer' should be created on the dev hosts, add them to the group devops, their password should be set using the pw_dev variable. Likewise create users with the job of 'manager' on the proxy host and add the users to the group 'managers', their password should be set using the pw_mgr variable.
users_list.yml
Create a role called sample-apache in /home/sandy/ansible/roles that enables and starts httpd, enables and starts the firewall and allows the webserver service. Create a templatecalled index.html.j2 which creates and serves a message from /var/www/html/index.html Whenever the content of the file changes, restart the webserver service.
Welcome to [FQDN] on [IP]
Replace the FQDN with the fully qualified domain name and IP with theip address of the node using ansible facts. Lastly, create a playbook in /home/sandy/ansible/ called apache.yml and use the role to serve the index file on webserver hosts.
Create a playbook /home/bob /ansible/motd.yml that runs on all inventory hosts and docs the following:
1.
The playbook should replaee any existing content of/etc/motd in the following text.
2.
Use ansible facts to display the FQDN of each host
3.
On hosts in the dev host group the line should be "Welcome to Dev Server FQDN".
4.
On hosts in the webserver host group the line should be "Welcome to Apache Server FQDN".
5.
On hosts in the database host group the line should be "Welcome to MySQL Server FQDN".
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.
What does the -a flag allow you to specify?
A. Allows a user to specify arguments for a given module.
B. Tells ansible to run in ad-hoc mode.
C. The -a flag has no use in Ansible.
D. Tells ansible to run against all hosts.
By default, how many times can a role be applied during a play?
A. Once, no matter the parameters provided.
B. As many times as necessary, no matter the parameters.
C. Once, presuming it is only applied with a single set of parameters.
D. As many times as necessary, presuming the `single_run' attribute is set to false.
Where does ansible-galaxy install place roles by default?
A. $PWD/roles
B. /etc/ansible/roles
C. /etc/roles
D. /usr/share/ansible/roles
How is Ansible Tower installed on your system?
A. It is installed with Ansible core.
B. Ansible Tower is provided through an rpm install.
C. Ansible Tower is provided in a tarball containing binaries, config files, and an installation script that must be ran.
D. A disk image may be downloaded and mounted containing the necessary Ansible Tower binaries.
How does a user Access Ansible Tower once it is installed?
A. By connecting to the control host using ssh and running 'tower-tui'
B. By running 'tower-connect' from your local CLI (on a graphical environment) and specifying the hostname of your Ansible Tower server.
C. By connecting making an https request to the server tower is installed on using a browser.
D. By running the ansible command and supplying the --tower flag running.
Where can you find a list of all modules in the Ansible online documentation?
A. Master Module List
B. All modules are listed on the online documentation landing page.
C. There is not a full list of all modules in the online documentation.
D. Module Index
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.
You can change the no of forks ansible uses from the /etc/ansible/ansible.cfg file.
A. True
B. False
State whether the following statement is true or false.
A template can only use 1 variable.
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
State whether the following statement is true or false.
If you create your own ansible facts file, it can be executable.
A. True
B. False