diff --git a/.gitignore b/.gitignore index 5c52af7..8fddf68 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -/keys-master/* -/keys-remote/* +#/keys-master/* +#/keys-remote/* diff --git a/detector-1.py b/detector-1.py deleted file mode 100644 index f4bf79d..0000000 --- a/detector-1.py +++ /dev/null @@ -1,38 +0,0 @@ -import nmap -import json - - -rpi_ip_list = [] -rpi_name_list = [] - - -def pi_search(): - print ('Searching for RPi') - print ("---------------------------") - - nm = nmap.PortScanner() - nm.scan('192.168.1.0/24',arguments='-sP') #Note :I tested with -sP to save time - for host in nm.all_hosts(): - #print(host + " "+nm[host].hostname()) - item = nm[host]['addresses'] - if nm[host].hostname() == 'raspberrypi' : - print (nm[host].hostname(),item) - if 'mac' in nm[host]['addresses']: - print('mac address found: {}'.format(nm[host]['addresses'])) - print('vendor: {}'.format(nm[host]['vendor'])) - - print ("---------------------------") - -def main(): - - if rpi_ip_list == []: - print ('Running nmap') - pi_search() - - -if __name__ == "__main__": - main() - - -#arp -a | grep b8:27:eb | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' -#Nmap can only retrieve the MAC address if you are scanning hosts on the local subnet diff --git a/group_vars/all b/group_vars/all index 69795ef..322bece 100644 --- a/group_vars/all +++ b/group_vars/all @@ -1,6 +1,7 @@ --- -<<<<<<< HEAD remote_directory: '/home/acam/Public/git/ansible-raspberry-sshupdate' -======= -remote_directory: '/home/acam/Public/git/ansible-raspberry-sshupdate/' ->>>>>>> 7a00d96e515279a7482a27f39a93c9b86f4fd0da + +foo: + pi1: one + pi2: two + diff --git a/host-firsttime b/host-firsttime new file mode 100755 index 0000000..63bcbd4 --- /dev/null +++ b/host-firsttime @@ -0,0 +1,9 @@ +[pi_master_host] +master ansible_host=127.0.0.1 ansible_connection=local ansible_user=acam + + +# first time with nothing about ssh +[pi_remote_hosts] +pi1 ansible_host=192.168.1.59 ansible_user=pi ansible_ssh_pass='raspberry' + + diff --git a/host_vars/master b/host_vars/master new file mode 100644 index 0000000..890bb99 --- /dev/null +++ b/host_vars/master @@ -0,0 +1,2 @@ +--- +ansible_user: "acam" diff --git a/host_vars/pi1 b/host_vars/pi1 new file mode 100644 index 0000000..2238bc4 --- /dev/null +++ b/host_vars/pi1 @@ -0,0 +1,3 @@ +--- +ansible_user: "pi" +ansible_ssh_private_key_file: '/home/acam/Public/git/ansible-raspberry-sshupdate/keys-master/id_rsa' diff --git a/host_vars/pi2 b/host_vars/pi2 new file mode 100644 index 0000000..956708b --- /dev/null +++ b/host_vars/pi2 @@ -0,0 +1,3 @@ +--- +ansible_user: "pi" +ansible_ssh_private_key_file: '/home/acam/Public/git/ansible-raspberry-sshupdate/keys-master/id_rsa1' diff --git a/hosts b/hosts index f86dac4..63c9f0c 100755 --- a/hosts +++ b/hosts @@ -1,15 +1,9 @@ [pi_master_host] -master ansible_host=127.0.0.1 ansible_connection=local ansible_user=acam - - -# first time with nothing about ssh -#[pi_remote_hosts] -#pi1 ansible_host=192.168.1.59 ansible_user=pi ansible_ssh_pass='raspberry' - +master ansible_host=127.0.0.1 ansible_connection=local # second time and refresh ssh certificate [pi_remote_hosts] -pi1 ansible_host=192.168.1.59 ansible_user='pi' ansible_ssh_private_key_file='/home/acam/Public/git/ansible-raspberry-sshupdate/keys-master/id_rsa' -#not seem to be the true variable ansible_ssh_private_key_file_pass='/dev/null' +pi1 ansible_host=192.168.1.59 ansible_connection=ssh + diff --git a/keys-master/.gitignore b/keys-master/.gitignore new file mode 100644 index 0000000..76bedae --- /dev/null +++ b/keys-master/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore + diff --git a/keys-master/empty b/keys-master/empty deleted file mode 100644 index e69de29..0000000 diff --git a/keys-remote/.gitignore b/keys-remote/.gitignore new file mode 100644 index 0000000..76bedae --- /dev/null +++ b/keys-remote/.gitignore @@ -0,0 +1,5 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore + diff --git a/keys-remote/empty b/keys-remote/empty deleted file mode 100644 index e69de29..0000000