No more verbose on kvm, use full kvm clone, up down interface instead of reboot

This commit is contained in:
2018-11-25 09:54:40 -05:00
parent 207f509a25
commit c8f851d4be
5 changed files with 15 additions and 8 deletions

View File

@@ -13,11 +13,11 @@
api_password: "{{ proxmox_password }}" api_password: "{{ proxmox_password }}"
api_host: "{{ proxmox_host }}" api_host: "{{ proxmox_host }}"
clone: "{{ ubuntu_template_vm_name }}" clone: "{{ ubuntu_template_vm_name }}"
full: no full: yes
name: '{{ inventory_hostname }}' name: '{{ inventory_hostname }}'
node: 'rack1' node: 'rack2'
target: '{{ hypervisor }}' target: '{{ hypervisor }}'
storage: 'synology-hdd' storage: 'SSD1'
format: 'qcow2' format: 'qcow2'
timeout: 6000 timeout: 6000
register: cloned register: cloned
@@ -59,6 +59,11 @@
timeout: 180 timeout: 180
when: cloned.changed 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 - include: ../roles/ansible-dependencies/tasks/main.yml
delegate_to: 10.0.0.211 delegate_to: 10.0.0.211
when: cloned.changed when: cloned.changed

View File

@@ -2,8 +2,11 @@
- name: Fix dpkg if needed - name: Fix dpkg if needed
raw: dpkg --configure -a raw: dpkg --configure -a
- name: Update apt
raw: apt-get update
- name: Install package dependencies - 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 - name: Install pip dependencies
raw: pip install ndg-httpsclient raw: pip install ndg-httpsclient

View File

@@ -1,8 +1,7 @@
{ {
{% if inventory_hostname == "nextcloud" %}"storage-driver": "devicemapper",{% endif %} {% 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"], "insecure-registries" : ["{{ registry_location }}","10.0.0.221:5000"],
"registry-mirrors": ["http://10.0.0.221:5000"], "registry-mirrors": ["http://10.0.0.221:5000"],
"metrics-addr" : "0.0.0.0:9323", "metrics-addr" : "0.0.0.0:9323",
"experimental" : true "experimental" : true
} }

View File

@@ -10,7 +10,7 @@
template: src=../roles/configure-interfaces/templates/eth.cfg.j2 dest=/etc/network/interfaces.d/{{ interface_name }}.cfg template: src=../roles/configure-interfaces/templates/eth.cfg.j2 dest=/etc/network/interfaces.d/{{ interface_name }}.cfg
- name: Up down interface - name: Up down interface
shell: "bash -c 'sleep 15s; reboot;' &" shell: "(sleep 3s; ifdown {{ interface_name }} && ifup {{ interface_name }};) &"
ignore_errors: true ignore_errors: true
vars: vars:
interface_name: "{{ ansible_default_ipv4.interface }}" interface_name: "{{ ansible_default_ipv4.interface }}"

View File

@@ -2,5 +2,5 @@
#keep adding dirname's to go up more directories. #keep adding dirname's to go up more directories.
project_dir="$(dirname $( dirname $(readlink -f ${BASH_SOURCE[0]})))" 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/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 ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ${project_dir}/hosts ${project_dir}/playbooks/site.yml