2.3 KiB
testnet-ops
Installation
-
Install Ansible
-
Add location of the directory containing the ansible binary to your
PATH -
Set Locale Encoding to
UTF-8Ansible requires the locale encoding to be
UTF-8. You can either use theLANGprefix when running Ansible commands or set the system-wide locale-
Option 1: Use
LANGPrefix in CommandsIf you prefer not to change the system-wide locale, you can use the
LANGprefix when running Ansible commands:LANG=en_US.UTF-8 ansible-playbook your_playbook.yml -
Option 2: Set System-Wide Locale
-
Edit the
/etc/default/localefile:sudo nano /etc/default/locale -
Set the
LANGvariable to en_US.UTF-8:LANG="en_US.UTF-8" -
Reboot your system or log out and log back in to apply the changes
-
-
Setup Remote Hosts
To run the playbook on a remote machine, setup the required ansible inventory:
-
Create a new
hosts.inifile:cp example-hosts.ini hosts.ini -
Edit the
hosts.inifile to run the playbook on a remote machine:[<deployment_host>] <host_name> ansible_host=<target_ip> ansible_user=<ssh_user> ansible_ssh_common_args='-o ForwardAgent=yes'- Replace
<deployment_host>with the appropriate host group for the deployment - Replace
<host_name>with the alias of your choice - Replace
<target_ip>with the IP address or hostname of the target machine - Replace
<ssh_user>with the SSH username (e.g., dev, ubuntu)
- Replace
-
Verify that you are able to connect to the host using the following command
ansible all -m ping -i hosts.ini -k # Expected output: # <host_name> | SUCCESS => { # "ansible_facts": { # "discovered_interpreter_python": "/usr/bin/python3.10" # }, # "changed": false, # "ping": "pong" # }