Create a playbook /home/bob /ansible/motd.yml that runs on all inventory hosts and docs the following: The playbook should replaee any existing content of/etc/motd in the following text. Use ansible facts to display the FQDN of each host
On hosts in the dev host group the line should be " Welcome to Dev Server FQDN " .
On hosts in the webserver host group the line should be " Welcome to Apache Server FQDN " .
On hosts in the database host group the line should be " Welcome to MySQL Server FQDN " .
Create a playbook called webdev.yml in ' home/sandy/ansible . The playbook will create a directory Avcbdev on dev host. The permission of the directory are 2755 and owner is webdev. Create a symbolic link from /Webdev to /var/www/html/webdev. Serve a file from Avebdev7index.html which display s the text " Development " Curl http://nod e1 . e xample.com/w e bd e v/index.html to test
Install the RHEL system roles package and create a playbook called timesync.yml that:
-- > Runs over all managed hosts.
-- > Uses the timesync role.
-- > Configures the role to use the time server 192.168.10.254 ( Hear in redhat lab
use " classroom.example.com " )
-- > Configures the role to set the iburst parameter as enabled.
Generate a hosts file:
* Download an initial template file hosts.j2 from http://classroom.example.com/
hosts.j2 to
/home/admin/ansible/ Complete the template so that it can be used to generate a file
with a
line for each inventory host in the same format as /etc/hosts:
172.25.250.9 workstation.lab.example.com workstation
* Create a playbook called gen_hosts.yml that uses this template to generate the file
/etc/myhosts on hosts in the dev host group.
* When completed, the file /etc/myhosts on hosts in the dev host group should have a
line for
each managed host:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.25.250.10 serevra.lab.example.com servera
172.25.250.11 serevrb.lab.example.com serverb
172.25.250.12 serevrc.lab.example.com serverc
172.25.250.13 serevrd.lab.example.com serverd
-----------------------------------------------------------------
while practising you to create these file hear. But in exam have to download as per
questation.
hosts.j2 file consists.
localhost localhost.localdomain localhost4 localhost4.localdomain4
::1
localhost localhost.localdomain localhost6 localhost6.localdomain6
-------------------------------------------------------------------
Modify file content.
------------------------
Create a playbook called /home/admin/ansible/modify.yml as follows:
* The playbook runs on all inventory hosts
* The playbook replaces the contents of /etc/issue with a single line of text as
follows:
-- > On hosts in the dev host group, the line reads: “Development”
-- > On hosts in the test host group, the line reads: “Test”
-- > On hosts in the prod host group, the line reads: “Production”
Create a role called apache in " /home/admin/ansible/roles " with the following
requirements:
-- > The httpd package is installed, enabled on boot, and started.
-- > The firewall is enabled and running with a rule to allow access to the web server.
-- > template file index.html.j2 is used to create the file /var/www/html/index.html
with the output:
Welcome to HOSTNAME on IPADDRESS
-- > Where HOSTNAME is the fqdn of the managed node and IPADDRESS is the IP-Address of
the managed node.
note: you have to create index.html.j2 file.
-- > Create a playbook called httpd.yml that uses this role and the playbook runs on
hosts in the webservers host group.
Create an Ansible vault to store user passwords as follows:
* The name of the vault is valut.yml
* The vault contains two variables as follows:
- dev_pass with value wakennym
- mgr_pass with value rocky
* The password to encrypt and decrypt the vault is atenorth
* The password is stored in the file /home/admin/ansible/password.txt