Commit f8e23640 authored by Rafael Monnerat's avatar Rafael Monnerat

playbook: vm-bootstrap - re-run ansible setup periodically for adjust setup after changes.

parent 8f8c258a
......@@ -3,7 +3,7 @@
connection: local
roles:
- vm-bootstrap
- { role: vm-bootstrap, startup_playbook_id: imt-vm-bootstrap.yml }
- ntp
- { role: vm-disks, vd_disk: b, data_n: 1 }
- { role: vm-disks, vd_disk: c, data_n: 2 }
......
......@@ -3,6 +3,6 @@
connection: local
roles:
- vm-bootstrap
- { role: vm-bootstrap, startup_playbook_id: imt-vm-bootstrap.yml }
- ntp
- vm-cloudera-manager
......@@ -23,3 +23,4 @@
- include: user.yml
- include: sudo.yml
- include: ssh.yml
- include: rerun.yml
---
- name: Add startup script
template: src=start-script.j2 dest=/usr/local/bin/vm-bootstrap-update mode=755
- name: Add a periodical update on the VM
cron: name="Update vm bootstrap"
minute="*/12"
job="/usr/local/bin/vm-bootstrap-update"
- name: Check if /opt/slapos.playbook already exists
file: path=/opt/slapos.playbook/ state=directory
- name: check if playbook is there
stat: path=/opt/slapos.playbook/playbook.tar.gz
register: playbook_archive
- name: Download playbook
shell: slapcache-download --destination=playbook.tar.gz
when: playbook_archive.stat.exists == False
args:
chdir: /opt/slapos.playbook
- name: Copy slapos.playbook
shell: tar -xzvf /opt/slapos.playbook/playbook.tar.gz
when: playbook_archive.stat.exists == False
args:
chdir: /opt/slapos.playbook
#!/bin/bash
# Reruns the ansible playbook, does nothing else
cd /opt/slapos.playbook
ansible-playbook {{ startup_playbook_id }} -i hosts --connection=local
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment