forked from inviqa/ansible-jumpcloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
158 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[ubuntu] | ||
ubuntu1604 ansible_ssh_host=172.16.3.2 | ||
ubuntu1404 ansible_ssh_host=172.16.3.3 | ||
ubuntu1204 ansible_ssh_host=172.16.3.4 | ||
|
||
|
||
[centos] | ||
centos7 ansible_ssh_host=172.16.3.5 | ||
centos6 ansible_ssh_host=172.16.3.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
|
||
- hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: delete test box | ||
local_action: shell vagrant destroy -f {{ inventory_hostname }} | ||
ignore_errors: true | ||
|
||
- hosts: localhost | ||
gather_facts: false | ||
tasks: | ||
- include_tasks: tasks/reset_ssh_agent.yml | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
|
||
- name: add 'vagrant_ssh_key' to ssh-agent | ||
local_action: shell ssh-add {{vagrant_ssh_key}} | ||
register: ssh_add_output | ||
ignore_errors: True | ||
|
||
- name: Check if `vagrant_ssh_key` has been added | ||
set_fact: | ||
vagrant_ssh_key_added: "{{ not 'not found' in ssh_add_output.stdout }}" | ||
|
||
- debug: | ||
msg: "Warning ==> vagrant_ssh_key wasn't added to ssh-agent" | ||
when: not vagrant_ssh_key_added | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
|
||
- name: Get `ssh-agent` status | ||
local_action: shell type ssh-agent | ||
register: ssh_agent_status | ||
ignore_errors: true | ||
|
||
- name: Check if `ssh-agent` is installed | ||
set_fact: | ||
ssh_agent_is_installed: "{{ not 'not found' in ssh_agent_status.stdout }}" | ||
|
||
- fail: | ||
msg: "Warning ==> ssh-agent is not installed" | ||
when: not ssh_agent_is_installed | ||
|
||
- name: stop 'ssh-agent' to reset the loaded keys | ||
local_action: shell killall -9 ssh-agent | ||
when: ssh_agent_is_installed | ||
ignore_errors: true | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
|
||
- name: Get `vagrant` status | ||
local_action: shell type vagrant | ||
register: vagrant_status | ||
ignore_errors: true | ||
run_once: true | ||
|
||
- name: Check if `vagrant` is installed | ||
set_fact: | ||
vagrant_is_installed: "{{ not 'not found' in vagrant_status.stdout }}" | ||
run_once: true | ||
|
||
- debug: | ||
msg: "Warning ==> vagrant is not installed" | ||
when: not vagrant_is_installed | ||
run_once: true | ||
|
||
- name: run 'vagrant up' | ||
local_action: shell vagrant up {{ inventory_hostname }} | ||
when: vagrant_is_installed | ||
register: vagrant_output | ||
ignore_errors: True | ||
|
||
- debug: var=vagrant_output.stdout_lines | ||
... |