Skip to content

Commit

Permalink
various tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sgsullivan committed Dec 11, 2019
1 parent 3212f2c commit 1fafe7d
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RUN yum install 'dnf-command(config-manager)' -y
RUN yum config-manager --set-enabled PowerTools
RUN yum install epel-release -y

RUN yum install ansible -y
RUN yum install ansible iputils -y

ADD exec-playbook /root/exec-playbook
ADD ansible.cfg /root/.ansible.cfg
Expand Down
10 changes: 6 additions & 4 deletions exec-playbook
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -euo pipefail
set -xeuo pipefail

[[ -z ${IP:-} ]] && {
echo "Environment variable [IP] is not defined. Cannot continue."
Expand All @@ -27,8 +27,10 @@ pkey_file=/root/.ssh/id_rsa
exit 1
}

# wait for network
echo "waiting for network.."
sleep 10
gw=$(ip r|grep -Po 'default via \S+'|awk '{print $3}')
arping ${gw} -c5
ping ${gw} -c5
arping ${IP} -c5
ping ${IP} -c5

ansible-playbook --ssh-extra-args="-i ${pkey_file}" -u root -i ${IP}, ${PLAYBOOK}
2 changes: 0 additions & 2 deletions playbook-example/hosts

This file was deleted.

Empty file.
5 changes: 5 additions & 0 deletions playbook-example/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Wait for network
wait_for_connection:
delay: 10
timeout: 300
Empty file.
6 changes: 5 additions & 1 deletion playbook-example/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
- hosts: all
name: Is this thing on?
gather_facts: false

roles:
- common

tasks:
- name: Create a file called '/tmp/derp' with content 'derpage'.
copy:
Expand Down

0 comments on commit 1fafe7d

Please sign in to comment.