Linux/Ansible: Difference between revisions
< Linux
No edit summary |
m (→Step-by-step) |
||
Line 33: | Line 33: | ||
== Step-by-step == | == Step-by-step == | ||
# | # Setup file structure | ||
# When using ssh key access | |||
#: <pre>ssh-copy-id -i ~/.ssh/id_rsa user@server</pre> | #: <pre>ssh-copy-id -i ~/.ssh/id_rsa user@server</pre> | ||
# | # When using ssh password | ||
#: <pre>apt install sshpass</pre> | |||
# Run ansible playbook | # Run ansible playbook | ||
#:<pre>ansible-playbook</pre> | #:<pre>ansible-playbook pb-hostname.yml</pre> | ||
#:options: | |||
#::-k (ssh pass) | |||
#::-K (password for sudo) | |||
= Links = | = Links = |
Revision as of 21:50, 7 December 2021
Other articles |
Install
sudo apt-get install -y software-properties-common sudo add-apt-repository -y ppa:ansible/ansible sudo apt-get update sudo apt-get install -y ansible
Commands
ansible --version
ansible-playbook pb-machinex.yml
ansible hostname -m setup # variables for "hostname"
Step-by-step
- Setup file structure
- When using ssh key access
ssh-copy-id -i ~/.ssh/id_rsa user@server
- When using ssh password
apt install sshpass
- Run ansible playbook
ansible-playbook pb-hostname.yml
- options:
- -k (ssh pass)
- -K (password for sudo)