Merge pull request #4272 from bhcleek/ansible-docker-test
Ansible docker test
This commit is contained in:
commit
3895ec40a3
|
@ -4,13 +4,6 @@
|
|||
{
|
||||
"type": "shell-local",
|
||||
"command": "echo 'TODO(bhcleek): write the public key to $HOME/.ssh/known_hosts and stop using ANSIBLE_HOST_KEY_CHECKING=False'"
|
||||
}, {
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"apt-get update",
|
||||
"apt-get -y install python openssh-sftp-server",
|
||||
"ls -l /usr/lib"
|
||||
]
|
||||
}, {
|
||||
"type": "ansible",
|
||||
"playbook_file": "./playbook.yml",
|
||||
|
@ -34,8 +27,8 @@
|
|||
"account_file": "{{user `account_file`}}",
|
||||
"project_id": "{{user `project_id`}}",
|
||||
"image_name": "packerbats-alloptions-{{timestamp}}",
|
||||
"source_image": "debian-7-wheezy-v20141108",
|
||||
"source_image": "debian-8-jessie-v20161027",
|
||||
"zone": "us-central1-a",
|
||||
"ssh_username": "root"
|
||||
"ssh_username": "debian"
|
||||
}]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"variables": {},
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"apt-get update",
|
||||
"apt-get -y install python"
|
||||
]
|
||||
}, {
|
||||
"type": "ansible",
|
||||
"playbook_file": "./playbook.yml",
|
||||
"extra_arguments": [
|
||||
],
|
||||
"sftp_command": "/usr/bin/false",
|
||||
"use_sftp": false
|
||||
}
|
||||
],
|
||||
"builders": [
|
||||
{
|
||||
"type": "docker",
|
||||
"image": "debian:jessie",
|
||||
"discard": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -12,9 +12,9 @@
|
|||
"account_file": "{{user `account_file`}}",
|
||||
"project_id": "{{user `project_id`}}",
|
||||
"image_name": "packerbats-minimal-{{timestamp}}",
|
||||
"source_image": "debian-7-wheezy-v20141108",
|
||||
"source_image": "debian-8-jessie-v20161027",
|
||||
"zone": "us-central1-a",
|
||||
"ssh_username": "root"
|
||||
"ssh_username": "debian"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
- hosts: default:packer-test
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: touch /root/ansible-raw-test
|
||||
raw: touch /root/ansible-raw-test
|
||||
- name: touch
|
||||
raw: touch /tmp/ansible-raw-test
|
||||
- name: raw test
|
||||
raw: date
|
||||
- name: command test
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
"account_file": "{{user `account_file`}}",
|
||||
"project_id": "{{user `project_id`}}",
|
||||
"image_name": "packerbats-scp-to-sftp-{{timestamp}}",
|
||||
"source_image": "debian-7-wheezy-v20141108",
|
||||
"source_image": "debian-8-jessie-v20161027",
|
||||
"zone": "us-central1-a",
|
||||
"ssh_username": "root",
|
||||
"ssh_username": "debian",
|
||||
"ssh_file_transfer_method": "sftp"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
"account_file": "{{user `account_file`}}",
|
||||
"project_id": "{{user `project_id`}}",
|
||||
"image_name": "packerbats-scp-{{timestamp}}",
|
||||
"source_image": "debian-7-wheezy-v20141108",
|
||||
"source_image": "debian-8-jessie-v20161027",
|
||||
"zone": "us-central1-a",
|
||||
"ssh_username": "root"
|
||||
"ssh_username": "debian"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -2,14 +2,6 @@
|
|||
"variables": {},
|
||||
"provisioners": [
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"apt-get update",
|
||||
"apt-get -y install python openssh-sftp-server",
|
||||
"ls -l /usr/lib",
|
||||
"#/usr/lib/sftp-server -?"
|
||||
]
|
||||
}, {
|
||||
"type": "ansible",
|
||||
"playbook_file": "./playbook.yml",
|
||||
"sftp_command": "/usr/lib/sftp-server -e -l INFO",
|
||||
|
@ -22,9 +14,9 @@
|
|||
"account_file": "{{user `account_file`}}",
|
||||
"project_id": "{{user `project_id`}}",
|
||||
"image_name": "packerbats-sftp-{{timestamp}}",
|
||||
"source_image": "debian-7-wheezy-v20141108",
|
||||
"source_image": "debian-8-jessie-v20161027",
|
||||
"zone": "us-central1-a",
|
||||
"ssh_username": "root"
|
||||
"ssh_username": "debian"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -43,6 +43,12 @@ teardown() {
|
|||
rm -rf $FIXTURE_ROOT/fetched-dir
|
||||
}
|
||||
|
||||
@test "ansible provisioner: build docker.json" {
|
||||
cd $FIXTURE_ROOT
|
||||
run packer build ${USER_VARS} $FIXTURE_ROOT/docker.json
|
||||
[ "$status" -eq 0 ]
|
||||
diff -r dir fetched-dir/default/tmp/remote-dir > /dev/null
|
||||
}
|
||||
@test "ansible provisioner: build minimal.json" {
|
||||
cd $FIXTURE_ROOT
|
||||
run packer build ${USER_VARS} $FIXTURE_ROOT/minimal.json
|
||||
|
|
Loading…
Reference in New Issue