Skip to content

Commit

Permalink
non-local comments added
Browse files Browse the repository at this point in the history
  • Loading branch information
arssher committed Sep 24, 2014
1 parent 2473532 commit e63be6d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions hosts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ansible-master
ssh_port_to_expose=2222

#n0x - real name of the host x; n0xhost - ansible alias for physical hosts
#this should be changed for non-local use
[docker-host-nodes]
#n01host ansible_ssh_port=22 ansible_ssh_host=n01
#n02host ansible_ssh_port=22 ansible_ssh_host=n02
Expand All @@ -15,6 +16,7 @@ ssh_port_to_expose=2222
#n06host ansible_ssh_port=22 ansible_ssh_host=n06
lochost ansible_ssh_port=22 ansible_ssh_host=localhost

#this should be changed for non-local use
[docker-containers]
#locdock ansible_ssh_port="{{ ssh_port_to_expose }}" ansible_ssh_user=root host_key_checking=False ansible_ssh_host=localhost

Expand Down
11 changes: 7 additions & 4 deletions test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
- name: build base image
docker_image: name="ubuntu/sshjdk" path=/tmp/ tag=14.04 state=present
- name: run container
#this should be changed in non-local mode: net=host only
docker: state=running image=ubuntu/sshjdk:14.04 net=bridge ports=2222 count=3
- name: Get facts about launched docker containers
docker_facts:
# add created containers to [docker-containers]
# add created containers to [docker-containers]
# this should be changed in non-local mode: we don't need to add containers to hosts
- name: add containers to [docker-containers]
add_host: hostname={{item.key}} ansible_ssh_host=172.17.42.1 ansible_ssh_port={{item.value.docker_ports[0].PublicPort}} ansible_ssh_user=root groups=docker-containers
when: item.value.docker_state.Running == True
Expand All @@ -36,14 +38,15 @@
when: item.value.docker_state.Running == True
with_dict: docker_containers

# check added hosts entries
# - template: src=docker_containers_tmpl dest=/tmp/docker_containers_result
# check added hosts entries
# - template: src=docker_containers_tmpl dest=/tmp/docker_containers_result
- hosts: docker-containers
roles:
- infinispan
tasks:
- name: check ssh
debug: var=ansible_ssh_port
# add private key to containers
# add private key to containers
# this should be changed in non-local mode: ssh between containers works
- copy: src=~/.ssh/id_rsa dest=/root/.ssh/id_rsa
- command: chmod 700 /root/.ssh/id_rsa

0 comments on commit e63be6d

Please sign in to comment.