Time required: 5 Hours
Create playbook and roles. Create a role to use the template to copy data to a server.
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.
Test with the command
ansible all -m ping
You should see a ping from the server.
Create playbook and roles. Create a role to use the template to copy data to a server.
Create playbook and roles. Create a role to use the template to copy data that has been encrypted with ansible-vault to a server. (localhost)
1. Setup Lab server as per prerequisites.
2. Create a role that uses variables.
3. Create a playbook that uses the variable.
4. Run the playbook and check it works.
5. Use ansible-vault to encrypt the variable file.
6. Run the playbook without the decrypt option on the command line.
7. Run the playbook with the decrypt option and notes the messages.