summaryrefslogtreecommitdiff
path: root/yarns/900-implements.yarn
diff options
context:
space:
mode:
Diffstat (limited to 'yarns/900-implements.yarn')
-rw-r--r--yarns/900-implements.yarn17
1 files changed, 16 insertions, 1 deletions
diff --git a/yarns/900-implements.yarn b/yarns/900-implements.yarn
index 2ffee04..7c40885 100644
--- a/yarns/900-implements.yarn
+++ b/yarns/900-implements.yarn
@@ -8,6 +8,11 @@ repeated for every step.
IMPLEMENTS GIVEN server name is (.+)
echo "SERVER=$MATCH_1" >> "$DATADIR/config.sh"
+Set account name to use on server.
+
+ IMPLEMENTS GIVEN server has account (.+)
+ echo "ACCOUNT=$MATCH_1" >> "$DATADIR/config.sh"
+
## Ping
Does the server respond to a ping?
@@ -22,7 +27,17 @@ Does the server's hostname match its domain name?
IMPLEMENTS THEN server hostname is as expected
. "$DATADIR/config.sh"
- ssh "$SERVER" hostname | grep -Fx "$SERVER"
+ ssh "$ACCOUNT@$SERVER" hostname | grep -Fx "$SERVER"
+
+## Ansible account
+
+Does the server have an account `ansible` that has passwordless sudo
+access to root?
+
+ IMPLEMENTS THEN server account has sudo
+ . "$DATADIR/config.sh"
+ ssh "$ACCOUNT@$SERVER" sudo -n id -u > "$DATADIR/id.out"
+ grep -F 0 "$DATADIR/id.out"
## Running command over ssh