From 083be2d91aae8f047c7d97f300a940dc8bf275c4 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kaminski Date: Mon, 31 Aug 2015 16:03:41 +0200 Subject: [PATCH] Packer.io: add juno packages, fix for ansible cfg and logging --- bootstrap/ansible.cfg | 2 ++ bootstrap/playbooks/build-main.yml | 1 + bootstrap/playbooks/tasks/cloud_archive.yml | 5 +++++ bootstrap/solar-master.json | 24 +++++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 bootstrap/ansible.cfg create mode 100644 bootstrap/playbooks/tasks/cloud_archive.yml diff --git a/bootstrap/ansible.cfg b/bootstrap/ansible.cfg new file mode 100644 index 00000000..14c80651 --- /dev/null +++ b/bootstrap/ansible.cfg @@ -0,0 +1,2 @@ +[defaults] +host_key_checking = False diff --git a/bootstrap/playbooks/build-main.yml b/bootstrap/playbooks/build-main.yml index d785a743..1e8d524d 100644 --- a/bootstrap/playbooks/build-main.yml +++ b/bootstrap/playbooks/build-main.yml @@ -9,3 +9,4 @@ - include: tasks/docker.yml #- include: celery.yml tags=['master'] celery_dir=/var/run/celery - include: tasks/cinder.yml + - include: tasks/cloud_archive.yml diff --git a/bootstrap/playbooks/tasks/cloud_archive.yml b/bootstrap/playbooks/tasks/cloud_archive.yml new file mode 100644 index 00000000..65e5c6b0 --- /dev/null +++ b/bootstrap/playbooks/tasks/cloud_archive.yml @@ -0,0 +1,5 @@ +--- + +- shell: add-apt-repository -y cloud-archive:juno + +- shell: apt-get update || apt-get update --fix-missing diff --git a/bootstrap/solar-master.json b/bootstrap/solar-master.json index 9a9117f3..f50b2c6a 100644 --- a/bootstrap/solar-master.json +++ b/bootstrap/solar-master.json @@ -1,4 +1,9 @@ { + "variables": { + "ansible_config_path": "/etc/ansible", + "ansible_config_file": "ansible.cfg", + "ansible_log_file": "/tmp/ansible.log" + }, "builders": [{ "type": "virtualbox-ovf", "source_path": "trusty64/box.ovf", @@ -7,6 +12,25 @@ "shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now" }], "provisioners": [ + { + "type": "shell", + "inline": ["sudo mkdir -p {{ user `ansible_config_path` }}"] + }, + { + "type": "file", + "source": "ansible.cfg", + "destination": "/tmp/ansible.cfg" + }, + { + "type": "shell", + "inline": ["sudo mv /tmp/ansible.cfg {{ user `ansible_config_path` }}/{{ user `ansible_config_file` }}"] + }, + { + "type": "shell", + "inline": [ + "sudo echo 'log_path = {{ user `ansible_log_file` }}' >> {{ user `ansible_config_path` }}/{{ user `ansible_config_file` }}" + ] + }, { "type": "shell", "script": "playbooks/files/ubuntu-ansible.sh"