From e63be6d7b7906ad9c58f59035ed41fd8b7cb2c8b Mon Sep 17 00:00:00 2001 From: Arseny Sher Date: Wed, 24 Sep 2014 20:34:52 +0400 Subject: [PATCH] non-local comments added --- hosts | 2 ++ test.yml | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hosts b/hosts index ee38826..f506e0b 100644 --- a/hosts +++ b/hosts @@ -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 @@ -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 diff --git a/test.yml b/test.yml index 1cf95e6..7f9cddf 100644 --- a/test.yml +++ b/test.yml @@ -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 @@ -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