From c8f851d4bef40ef2979e9117b718534117d7f58d Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Sun, 25 Nov 2018 09:54:40 -0500 Subject: [PATCH] No more verbose on kvm, use full kvm clone, up down interface instead of reboot --- playbooks/kvm.yml | 11 ++++++++--- roles/ansible-dependencies/tasks/main.yml | 5 ++++- roles/common/templates/docker-daemon.json.j2 | 3 +-- roles/configure-interfaces/tasks/main.yml | 2 +- supporting-scripts/site.sh | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/playbooks/kvm.yml b/playbooks/kvm.yml index 342f839..cbf086a 100644 --- a/playbooks/kvm.yml +++ b/playbooks/kvm.yml @@ -13,11 +13,11 @@ api_password: "{{ proxmox_password }}" api_host: "{{ proxmox_host }}" clone: "{{ ubuntu_template_vm_name }}" - full: no + full: yes name: '{{ inventory_hostname }}' - node: 'rack1' + node: 'rack2' target: '{{ hypervisor }}' - storage: 'synology-hdd' + storage: 'SSD1' format: 'qcow2' timeout: 6000 register: cloned @@ -59,6 +59,11 @@ timeout: 180 when: cloned.changed + - name: Wait 120 seconds for apt + wait_for: timeout=120 + delegate_to: localhost + when: cloned.changed + - include: ../roles/ansible-dependencies/tasks/main.yml delegate_to: 10.0.0.211 when: cloned.changed diff --git a/roles/ansible-dependencies/tasks/main.yml b/roles/ansible-dependencies/tasks/main.yml index 5f34a6a..8f30282 100644 --- a/roles/ansible-dependencies/tasks/main.yml +++ b/roles/ansible-dependencies/tasks/main.yml @@ -2,8 +2,11 @@ - name: Fix dpkg if needed raw: dpkg --configure -a +- name: Update apt + raw: apt-get update + - name: Install package dependencies - raw: apt-get update -qq && apt-get install -y python-simplejson python-urllib3 python-openssl python-pyasn1 python-pip ca-certificates + raw: apt-get install -y python-simplejson python-urllib3 python-openssl python-pyasn1 python-pip ca-certificates - name: Install pip dependencies raw: pip install ndg-httpsclient diff --git a/roles/common/templates/docker-daemon.json.j2 b/roles/common/templates/docker-daemon.json.j2 index a1000c5..104e640 100644 --- a/roles/common/templates/docker-daemon.json.j2 +++ b/roles/common/templates/docker-daemon.json.j2 @@ -1,8 +1,7 @@ { {% if inventory_hostname == "nextcloud" %}"storage-driver": "devicemapper",{% endif %} - "hosts": ["unix:///var/run/docker.sock", "tcp://0.0.0.0:2375"], "insecure-registries" : ["{{ registry_location }}","10.0.0.221:5000"], "registry-mirrors": ["http://10.0.0.221:5000"], "metrics-addr" : "0.0.0.0:9323", "experimental" : true -} \ No newline at end of file +} diff --git a/roles/configure-interfaces/tasks/main.yml b/roles/configure-interfaces/tasks/main.yml index 097051c..41a5c68 100644 --- a/roles/configure-interfaces/tasks/main.yml +++ b/roles/configure-interfaces/tasks/main.yml @@ -10,7 +10,7 @@ template: src=../roles/configure-interfaces/templates/eth.cfg.j2 dest=/etc/network/interfaces.d/{{ interface_name }}.cfg - name: Up down interface - shell: "bash -c 'sleep 15s; reboot;' &" + shell: "(sleep 3s; ifdown {{ interface_name }} && ifup {{ interface_name }};) &" ignore_errors: true vars: interface_name: "{{ ansible_default_ipv4.interface }}" diff --git a/supporting-scripts/site.sh b/supporting-scripts/site.sh index c806502..c7506d9 100755 --- a/supporting-scripts/site.sh +++ b/supporting-scripts/site.sh @@ -2,5 +2,5 @@ #keep adding dirname's to go up more directories. project_dir="$(dirname $( dirname $(readlink -f ${BASH_SOURCE[0]})))" #ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ${project_dir}/hosts ${project_dir}/playbooks/lxc-test.yml -ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ${project_dir}/hosts ${project_dir}/playbooks/kvm.yml -vvvv +ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ${project_dir}/hosts ${project_dir}/playbooks/kvm.yml ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ${project_dir}/hosts ${project_dir}/playbooks/site.yml