parent
45a03fc465
commit
a3885fe5ce
@ -1,2 +1,3 @@ |
|||||||
vars/all.yml |
vars/all.yml |
||||||
.ssh |
.ssh |
||||||
|
inventory |
||||||
|
@ -0,0 +1,30 @@ |
|||||||
|
#!/usr/bin/env bash |
||||||
|
set -e |
||||||
|
|
||||||
|
if [ ! -f .ssh/id_ed25519.pub ]; then |
||||||
|
echo "Generating new ssh key pair..." |
||||||
|
ssh-keygen -t ed25519 -f .ssh/id_ed25519 -N "" |
||||||
|
fi |
||||||
|
|
||||||
|
echo "Installing dependencies..." |
||||||
|
ansible-galaxy install -r requirements.yml |
||||||
|
|
||||||
|
new_ip_addr=true |
||||||
|
if [ -f inventory ]; then |
||||||
|
current_ip_addr=$(cat inventory | awk 'NR==2') |
||||||
|
read -p "Target ip is $current_ip_addr, do you want to change it? (y/N): " res |
||||||
|
[[ $res =~ [Yy] ]] || new_ip_addr=false |
||||||
|
fi |
||||||
|
|
||||||
|
echo $new_ip_addr |
||||||
|
|
||||||
|
if [ $new_ip_addr ]; then |
||||||
|
read -p "Target ip address: " ip_addr |
||||||
|
echo "[all]" > inventory |
||||||
|
echo $ip_addr >> inventory |
||||||
|
fi |
||||||
|
|
||||||
|
exit 1 |
||||||
|
|
||||||
|
echo "Running playbook, this may take 5 to 10 minutes..." |
||||||
|
ansible-playbook main.yml -k |
@ -1,5 +0,0 @@ |
|||||||
--- |
|
||||||
all: |
|
||||||
hosts: |
|
||||||
<ip_addr>: |
|
||||||
ansible_user: root |
|
Loading…
Reference in new issue