Skip to content

Lab12Automation

echadbourne edited this page Nov 15, 2023 · 2 revisions

Setup

Basic Configuration:

  • clone1: 10.0.5.70
  • clone2: 10.0.5.71
  • clone3: 10.0.5.72

PSSH

Make sure to do this with your named user and NOT root!

Install epel-release and pssh

  • yum install epel-release pssh -y

Make a keypair with ssh-keygen

  • Passphrase is located in password vault (not default)

Copy the key to clone2 and clone3 with ssh-copy-id elizabeth.chadbourne@clone2/@clone 3

  • Log in with ssh to check that it worked

SSH Agent

You can cache the password using ssh-agent

Note: for this section only, apostrophes (') will represent back-ticks (`)

eval 'ssh-agent' - load ssh-agent

ssh-add -t 1h - caches for 1 hour (1h)

/etc/sudoers

On both clone2 and clone3 edit the config file /etc/sudoers so the line "%wheel ALL=(ALL) NOPASSWD: ALL" is uncommented

Back to PSSH

Make a pssh hosts file containing clone2 and clone3:

  • elizabeth.chadbourne@clone2
  • elizabeth.chadbourne@clone3

pssh -i -h [host filename] [command(s)]

Ansible

Install ansible with sudo yum install ansible -y

Run the following to ping all the hosts in the hosts file (as a test):

  • ansible all -i hosts -m ping

Clone this wiki locally