-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathprovision-vagrant.yml
44 lines (33 loc) · 1.54 KB
/
provision-vagrant.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
- hosts: all
sudo: yes
# run with ansible-playbook register-key.yml -i hosts --ask-pass --ask-sudo-pass -u [your username] --extra-vars "user=[your username]"
tasks:
- name: add user ubuntu
user: name=ubuntu
groups="admin,ubuntu"
- name: register key for user ubuntu
action: authorized_key user='ubuntu' key="{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
- name: ensure apt cache is updated
action: apt update_cache=yes
- name: ensure all software is installed
action: apt name={{item}}
with_items:
- emacs24
- tmux
- docker.io
- curl
- name: ensure docker is linked
shell: ln -sf /usr/bin/docker.io /usr/local/bin/docker creates=/usr/local/bin/docker
- name: create directory to be shared between host and container
shell: mkdir -p /home/vagrant/html creates=/home/vagrant/html
- name: ensure docker is started on startup
shell: update-rc.d docker.io defaults
- name: copy over the index.html file to be served by the Docker container
action: copy src=conf/index.html dest=/home/vagrant/html/index.html
- name: copy over the Dockerfile
action: copy src=conf/Dockerfile dest=/home/vagrant/Dockerfile
- name: copy over the Ansible file with which we provision the Docker container
action: copy src=conf/provision.yml dest=/home/vagrant/provision.yml
- name: copy over the inventory file for Dockers Ansible provisioning
action: copy src=conf/inventory-file dest=/home/vagrant/inventory-file