Skip to content

Commit

Permalink
IP address extraction of master container and embedding the same in b…
Browse files Browse the repository at this point in the history
…ashrc for through login. Implemented in a better and refined way
  • Loading branch information
arnabsinha4u committed Jan 25, 2017
1 parent 3ab35b6 commit 726dfc0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ansible_lab_master_slave.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,18 @@
tags:
- m_startup

- name: Extract IP Address for Master Container
command: "docker inspect --format {% raw %} '{{ .NetworkSettings.IPAddress }}' {% endraw %} master-{{ master_name }}"
register: master_ip_address
tags:
- m_startup
- cli_startup

- name: SSH forwarding into bashrc
command: echo "ssh root@`docker exec master-{{ master_name }} hostname -I`;exit" >> /home/ansiblelabuser{{ master_name }}/.bashrc
lineinfile:
dest: /home/ansiblelabuser{{ master_name }}/.bashrc
line: "ssh root@{{ master_ip_address.stdout }};exit"
state: present
tags:
- m_startup
- cli_startup
Expand Down

0 comments on commit 726dfc0

Please sign in to comment.