Add a try to install_prerequisites ping checks

Sometimes the ping -c1 `hostname -s` fails, but when ssh to the machine
and running the same command it works. Add another try after 5 seconds
if the ping check fails.
How about using a for loop to deduplicate the business logic?

```python
for command in (
        'ping -c1 localhost', 'ping -c1 $(hostname -s)',
        'ping -c1 $(hostname -f)'):
    if run(command, warn_only=True).return_code != 0:
        time.sleep(5)
        run(command)
```

Or, if the above is too terse:

```python
for command in (
        'ping -c1 localhost', 'ping -c1 $(hostname -s)',
        'ping -c1 $(hostname -f)'):
    result = run(command, warn_only=True)
    if result.return_code != 0:
        time.sleep(5)
        run(command)
```