Configure a host for remote execution.
Outcomes
Configure a host for remote execution.
Import an Ansible Role into Satellite and modify the role's default variables.
Run a role remotely to install and configure an Apache web server.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command prepares your environment and ensures that all required resources are available.
[student@workstation ~]$ lab start remote-review
Instructions
Copy the Foreman SSH keys from each Capsule Server to the serverb and serverd content hosts that are the remote execution targets.
Satellite Server can delegate any Capsule Server that is authorized to provide remote execution to content hosts in managed locations. Copy the required Foreman SSH public keys from each authorized Capsule Server, including the integrated Capsule Server on the Satellite Server, to each content host that can be a remote execution target.
Log in to the capsule system as the student user and switch to the root user.
[student@workstation ~]$ssh student@capsule[student@capsule ~]$sudo -i[sudo] password for student:student[root@capsule ~]#
Copy the Capsule Server's Foreman SSH public key to the serverb content host.
[root@capsule ~]#ssh-copy-id \ -i ~foreman-proxy/.ssh/id_rsa_foreman_proxy.pub \ root@serverb.lab.example.com...output omitted... Are you sure you want to continue connecting (yes/no)?yes...output omitted... root@serverb.lab.example.com's password:redhatNumber of key(s) added: 1 ...output omitted...
Copy the Capsule Server's Foreman SSH public key to the serverd content host.
[root@capsule ~]#ssh-copy-id \ -i ~foreman-proxy/.ssh/id_rsa_foreman_proxy.pub \ root@serverd.lab.example.com...output omitted... Are you sure you want to continue connecting (yes/no)?yes...output omitted... root@serverd.lab.example.com's password:redhatNumber of key(s) added: 1 ...output omitted...
Use the foreman-proxy identity to test the root@serverb account for passwordless access from the capsule system.
If the public key was successfully copied, then you can access the account without a password prompt.
Exit the serverb system to return to the capsule system.
[root@capsule ~]#ssh -i ~foreman-proxy/.ssh/id_rsa_foreman_proxy root@serverb...output omitted... Are you sure you want to continue connecting (yes/no/[fingerprint])?yes...output omitted... [root@serverb ~]#exitlogout [root@capsule ~]#
Use the foreman-proxy identity to test the root@serverd account for passwordless access from the capsule system.
If the public key was successfully copied, then you can access the account without a password prompt.
Exit the serverd system to return to the capsule system.
[root@capsule ~]#ssh -i ~foreman-proxy/.ssh/id_rsa_foreman_proxy root@serverd...output omitted... Are you sure you want to continue connecting (yes/no/[fingerprint])?yes...output omitted... [root@serverd ~]#exitlogout [root@capsule ~]#
Return to the workstation system as the student user.
Log in to the satellite server as the student user and switch to the root user.
[root@capsule ~]#exitlogout [student@capsule ~]$exitlogout [student@workstation ~]$ssh student@satellite[student@satellite ~]$sudo -i[sudo] password for student:student[root@satellite ~]#
Copy the Satellite Server's Foreman SSH public key to the serverb content host.
[root@satellite ~]#ssh-copy-id -i \ ~foreman-proxy/.ssh/id_rsa_foreman_proxy.pub \ root@serverb.lab.example.com...output omitted... Are you sure you want to continue connecting (yes/no)?yes...output omitted... root@serverb.lab.example.com's password:redhatNumber of key(s) added: 1 ...output omitted...
Copy the Satellite Server's Foreman SSH public key to the serverd content host.
[root@satellite ~]#ssh-copy-id -i \ ~foreman-proxy/.ssh/id_rsa_foreman_proxy.pub \ root@serverd.lab.example.com...output omitted... Are you sure you want to continue connecting (yes/no)?yes...output omitted... root@serverd.lab.example.com's password:redhatNumber of key(s) added: 1 ...output omitted...
Use the foreman-proxy identity to test the root@serverb account for passwordless access from the satellite system.
If the public key was successfully copied, then you can access the account without a password prompt.
Exit the serverb system to return to the satellite system.
[root@satellite ~]#ssh -i ~foreman-proxy/.ssh/id_rsa_foreman_proxy root@serverb...output omitted... Are you sure you want to continue connecting (yes/no/[fingerprint])?yes...output omitted... [root@serverb ~]#exitlogout [root@satellite ~]#
Use the foreman-proxy identity to test the root@serverd account for passwordless access from the satellite system.
If the public key was successfully copied, then you can access the account without a password prompt.
Exit the serverd system to return to the satellite system.
[root@satellite ~]#ssh -i ~foreman-proxy/.ssh/id_rsa_foreman_proxy root@serverd...output omitted... Are you sure you want to continue connecting (yes/no/[fingerprint])?yes...output omitted... [root@serverd ~]#exitlogout [root@satellite ~]#
Create a custom Ansible Role on the satellite system from the downloaded apache-setup-role.tgz archive.
Store the extracted role content in the /etc/ansible/roles directory.
The downloaded role archive is in the root account's home directory on the satellite system.
Extract the apache-setup-role.tgz file.
[root@satellite ~]# tar xzvf apache-setup-role.tgz
...output omitted...Copy the apache-setup-role directory to the /etc/ansible/roles/ directory:
[root@satellite ~]# cp -R apache-setup-role /etc/ansible/roles/Import the apache-setup-role Ansible Role into the Finance organization in Satellite.
Log in to the Satellite Server web UI, https://satellite.lab.example.com, as the admin user with redhat as the password.
In the upper-left corner of the web page, set the organization to Finance.
Set the location to Any Location.
Click → , and then click . Select the checkbox for from the list of available Ansible Roles. Click .
Set the apache_test_message role variable to Satellite set this variable.
Assign the new role to the serverb and serverd content hosts.
Use the Ansible Role to install and configure a web server on each of the serverb and serverd hosts.
Verify that a functional Apache web server is deployed on each of the serverb and serverd hosts, and that the displayed output includes the apache_test_message text.
Use your browser to navigate to http://serverb.lab.example.com.
Verify that the output includes the Satellite set this variable text on the first line.
Use your browser to navigate to http://serverd.lab.example.com.
Verify that the output includes the Satellite set this variable text on the first line.