Time required: 1 Hours
Use a playbook to display multiple facts at the same time.
Standard tasks for all lab servers to set them up for self use.
Log into the lab server as user then sudo to the root user.
sudo su -
Install ansible with
yum install ansible
Add the local server as a local group.
Edit the /etc/ansible/hosts file. Put the following at the top.
[local]
localhost
[single]
localhost
[databases]
localhost
[other]
localhost
[temp]
localhost
Save the /etc/ansible/hosts file.
Create an ansible user to use with the labs.
sudo useradd -G wheel ansible
Log out and log in as the ansible user.
Create an ssh key for your user.
ssh-keygen
Use the ssh-copy-id command to copy your own ssh key to your own user's authority file.
ssh-copy-id localhost
Use the ansible all -m ping command to test connectivity to the localhost. You should now be ready to use the lab server.
use a playbook to display multiple facts at the same time.
Use a playbook to display multiple facts at the same time.
1. Setup Lab server as per Pre-requisites.
2. Create a playbook
3. Use the debug to display the hostname when the playbook is run.
4. Modify the playbook to display multiple facts at the same time.
5. Select other ansible fact variables and display those when you run the playbook.