script for anisble in phpstorm
cron for restarting failed vms
This commit is contained in:
@@ -18,7 +18,8 @@ services:
|
|||||||
# ports:
|
# ports:
|
||||||
# - "8125:8125/udp"
|
# - "8125:8125/udp"
|
||||||
deploy:
|
deploy:
|
||||||
mode: global
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: any
|
condition: any
|
||||||
delay: "1m"
|
delay: "1m"
|
||||||
|
|||||||
@@ -41,7 +41,8 @@
|
|||||||
# - Datadog.datadog
|
# - Datadog.datadog
|
||||||
# - dockerhost
|
# - dockerhost
|
||||||
# - dynamic-ip
|
# - dynamic-ip
|
||||||
- bootstrap_vms
|
# - bootstrap_vms
|
||||||
|
- home.xai-corp.net
|
||||||
- cleanup
|
- cleanup
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
|
|||||||
@@ -4,18 +4,17 @@ localhost ansible_connection=local
|
|||||||
home ansible_ssh_host=192.168.2.11
|
home ansible_ssh_host=192.168.2.11
|
||||||
home02 ansible_ssh_host=192.168.2.22
|
home02 ansible_ssh_host=192.168.2.22
|
||||||
dkhost01 ansible_ssh_host=192.168.2.41
|
dkhost01 ansible_ssh_host=192.168.2.41
|
||||||
dkhost02 ansible_ssh_host=192.168.2.43
|
dkhost02 ansible_ssh_host=192.168.2.52
|
||||||
dkhost03 ansible_ssh_host=192.168.2.53
|
#dkhost03 ansible_ssh_host=192.168.2.53
|
||||||
#dkhost04 ansible_ssh_host=192.168.2.54
|
dkhost04 ansible_ssh_host=192.168.2.54
|
||||||
#dkhost05 ansible_ssh_host=192.168.2.55
|
#dkhost05 ansible_ssh_host=192.168.2.55
|
||||||
#logs ansible_ssh_host=192.168.2.42
|
|
||||||
cubox-i ansible_ssh_host=192.168.2.12
|
cubox-i ansible_ssh_host=192.168.2.12
|
||||||
|
|
||||||
[dkhost]
|
[dkhost]
|
||||||
dkhost01 ansible_ssh_host=192.168.2.41
|
dkhost01 ansible_ssh_host=192.168.2.41
|
||||||
dkhost02 ansible_ssh_host=192.168.2.52
|
dkhost02 ansible_ssh_host=192.168.2.52
|
||||||
#dkhost03 ansible_ssh_host=192.168.2.53
|
#dkhost03 ansible_ssh_host=192.168.2.53
|
||||||
#dkhost04 ansible_ssh_host=192.168.2.54
|
dkhost04 ansible_ssh_host=192.168.2.54
|
||||||
#dkhost05 ansible_ssh_host=192.168.2.55
|
#dkhost05 ansible_ssh_host=192.168.2.55
|
||||||
home ansible_ssh_host=192.168.2.11
|
home ansible_ssh_host=192.168.2.11
|
||||||
#localhost ansible_connection=local
|
#localhost ansible_connection=local
|
||||||
|
|||||||
17
roles/home.xai-corp.net/tasks/cron.yml
Normal file
17
roles/home.xai-corp.net/tasks/cron.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
# configure crons on home.xai-corp.net
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- name: create vm reset crons
|
||||||
|
cron:
|
||||||
|
name: vm_reset_{{item}}
|
||||||
|
state: present
|
||||||
|
special_time: hourly
|
||||||
|
user: root
|
||||||
|
job: 'ping -c1 {{item}} || vboxmanage controlvm {{item}} reset &>/dev/null'
|
||||||
|
cron_file: vm_reset
|
||||||
|
with_items:
|
||||||
|
- dkhost01
|
||||||
|
- dkhost02
|
||||||
|
- dkhost04
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
# tasks/main.yml
|
# tasks/main.yml
|
||||||
# define tasks here
|
# define tasks here
|
||||||
|
|
||||||
- include: vhosts.yml
|
- include: cron.yml
|
||||||
|
|||||||
5
scripts/ansible.sh
Normal file
5
scripts/ansible.sh
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# run ansible playbook to update name servers
|
||||||
|
|
||||||
|
ansible-playbook -vv ${PLAYBOOK}.yml -i inventory.conf -u ansible
|
||||||
Reference in New Issue
Block a user