Skip to content

Commit

Permalink
Merge pull request #50 from Diesel-Net/development
Browse files Browse the repository at this point in the history
Promotion
  • Loading branch information
tomdaley92 authored Jan 22, 2022
2 parents 2e96c40 + c652b22 commit fc268bf
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 31 deletions.
17 changes: 13 additions & 4 deletions .ansible/deploy.yaml → .ansible/bootstrap.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
- hosts: localhost
strategy: free
- import_playbook: power_on.yaml

- hosts: manager:worker
strategy: linear
gather_facts: no
tasks:

- name: wait for connections
wait_for_connection:

- include_role:
name: ubuntu
tasks_from: scan_hosts


- hosts: all
- hosts: manager:worker
strategy: free
tasks:

- include_role:
name: ubuntu
tasks_from: setup_user
Expand All @@ -18,7 +26,7 @@
ansible_sudo_pass: "{{ ansible_ssh_pass }}"


- hosts: all
- hosts: manager:worker
strategy: free
roles:
- ubuntu
Expand All @@ -42,3 +50,4 @@
name: docker
tasks_from: install_nvidia_toolkit

- import_playbook: power_off.yaml
12 changes: 10 additions & 2 deletions .ansible/clean.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
- hosts: all
- import_playbook: power_on.yaml

- hosts: manager:worker
strategy: free
gather_facts: no
tasks:

- name: wait for connections
wait_for_connection:

- include_role:
name: docker
tasks_from: system_prune
vars:
options: --all
options: --volumes

- import_playbook: power_off.yaml
3 changes: 2 additions & 1 deletion .ansible/files/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dnspython==2.1.0
dnspython
proxmoxer
7 changes: 0 additions & 7 deletions .ansible/group_vars/all/main.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions .ansible/group_vars/all/proxmox.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
proxmox_realm: pve
proxmox_user: '{{ lookup("env", "PROXMOX_USER") }}@{{ proxmox_realm }}'
proxmox_password: '{{ lookup("env", "PROXMOX_PASS") }}'
proxmox_api_host: pve.diesel.net
proxmox_node: pve
11 changes: 11 additions & 0 deletions .ansible/inventory/development/hosts
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
all:
children:


manager:
hosts:

dev.diesel.net:

automation-station.diesel.net:
auto_reboots: no


offline:
hosts:

automation-station.diesel.net:

vars:
ansible_user: automation
Expand Down
21 changes: 12 additions & 9 deletions .ansible/inventory/production/hosts
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
all:
children:


manager:
hosts:

prod.diesel.net:
automation-station.diesel.net:

drone:
hosts:
drone.diesel.net:
auto_reboots: no

tools:
hosts:
tools.diesel.net:

games:
hosts:
games.diesel.net:

es:
hosts:
es.diesel.net:

gpu.diesel.net:


nvidia:
hosts:

gpu.diesel.net:


offline:
hosts:

games.diesel.net

vars:
ansible_user: automation
ansible_python_interpreter: /usr/bin/python3
2 changes: 2 additions & 0 deletions .ansible/inventory/stable/hosts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
all:
children:


manager:
hosts:

test.diesel.net:

vars:
Expand Down
14 changes: 14 additions & 0 deletions .ansible/power_off.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- hosts: offline
gather_facts: no
strategy: free
tasks:

- name: power off VMs
proxmox_kvm:
name: '{{ inventory_hostname_short }}'
api_user: '{{ proxmox_user }}'
api_password: '{{ proxmox_password }}'
api_host: '{{ proxmox_api_host }}'
node: '{{ proxmox_node }}'
state: stopped
delegate_to: localhost
15 changes: 15 additions & 0 deletions .ansible/power_on.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- hosts: offline
gather_facts: no
strategy: free
tasks:

- name: power on VMs
proxmox_kvm:
name: '{{ inventory_hostname_short }}'
api_user: '{{ proxmox_user }}'
api_password: '{{ proxmox_password }}'
api_host: '{{ proxmox_api_host }}'
node: '{{ proxmox_node }}'
state: started
delegate_to: localhost

4 changes: 2 additions & 2 deletions .ansible/roles/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- name: ubuntu
scm: git
src: "[email protected]:Diesel-Net/ansible-role-ubuntu.git"
version: 2.5.0
version: 2.5.1

- name: common
scm: git
Expand All @@ -11,4 +11,4 @@
- name: docker
scm: git
src: "[email protected]:Diesel-Net/ansible-role-docker.git"
version: 1.10.0
version: 1.11.0
10 changes: 9 additions & 1 deletion .ansible/update.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
- hosts: all
- import_playbook: power_on.yaml

- hosts: manager:worker
strategy: free
gather_facts: no
tasks:

- name: wait for connections
wait_for_connection:

- import_role:
name: ubuntu
tasks_from: update

- import_playbook: power_off.yaml
Loading

0 comments on commit fc268bf

Please sign in to comment.