Open craig8 opened 9 months ago
all: hosts: substation1: ansible_host: 127.0.0.1 ansible_connection: local volttron_home: volttron_home1
This is how a local connection is built within the ansible inventory.yml file. Then running
ansible-playbook -K -i inventory.yml volttron.deployment.host_config
will install the sudo user requirements for the base system of volttron.
--- - hosts: localhost connection: local tasks: - debug: var=ansible_all_ipv4_addresses - debug: var=ansible_default_ipv4.address
This is one way to get the ipv4 addresses from the system.
~/.volttron_installer/platforms$ ansible-playbook localhost.yml [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [localhost] *********************************************************************************************************************************************************************************************************************************************************************************************************************** TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************************************************************************************************************************** ok: [localhost] TASK [debug] *************************************************************************************************************************************************************************************************************************************************************************************************************************** ok: [localhost] => { "ansible_all_ipv4_addresses": [ "172.17.0.1", "10.1.0.7", "172.18.0.1" ] } TASK [debug] *************************************************************************************************************************************************************************************************************************************************************************************************************************** ok: [localhost] => { "ansible_default_ipv4.address": "10.1.0.7" }
You can also use
import socket socket.gethostbyname(socket.gethostname())
To get an ip address for the current system.
Local connections should have ansible_connection local and the ip address associated with it.
This is how a local connection is built within the ansible inventory.yml file. Then running
will install the sudo user requirements for the base system of volttron.
Local host ipv4 addresses.
This is one way to get the ipv4 addresses from the system.