ship playbooks with python
This patch makes the playbooks ship directly with the Python files which means no need to run inside working directory. Change-Id: I3f2d3c95a8443383b47d806e293c9bb75d9fcec7
This commit is contained in:
parent
eddb78f48a
commit
cc4ec215d3
|
@ -3,4 +3,6 @@
|
|||
.vagrant
|
||||
.vscode
|
||||
__pycache__
|
||||
*.egg-info
|
||||
*.egg-info
|
||||
AUTHORS
|
||||
ChangeLog
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
import shutil
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
import ansible_runner
|
||||
|
||||
|
@ -23,10 +24,11 @@ class Cluster(object):
|
|||
self.config = config
|
||||
|
||||
def deploy(self):
|
||||
playbooks_dir = "%s/playbooks" % os.path.dirname(__file__)
|
||||
private_data_dir = tempfile.mkdtemp()
|
||||
|
||||
try:
|
||||
shutil.copytree('ansible', '%s/project' % private_data_dir)
|
||||
shutil.copytree(playbooks_dir, '%s/project' % private_data_dir)
|
||||
ansible_runner.run(private_data_dir=private_data_dir,
|
||||
inventory=self.config.inventory,
|
||||
playbook='site.yaml')
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
- name: Test kue-cli
|
||||
shell: >-
|
||||
kue-cli --user {{ ansible_user }} {% for master in groups['masters'] %}--master {{ hostvars[master]['ansible_host'] }} {% endfor %}{% for minion in groups['minions'] %}--minion {{ hostvars[minion]['ansible_host'] }} {% endfor %}
|
||||
args:
|
||||
chdir: "{{ zuul.project.src_dir }}"
|
||||
|
||||
- hosts: masters[0]
|
||||
tasks:
|
||||
|
|
Loading…
Reference in New Issue