Linux/Ansible: Difference between revisions
< Linux
mNo edit summary |
m (→Install) |
||
Line 18: | Line 18: | ||
<pre> | <pre> | ||
ansible-galaxy collection install ansible.posix | ansible-galaxy collection install ansible.posix | ||
ansible-galaxy collection install community.general | |||
</pre> | </pre> | ||
Revision as of 11:03, 8 December 2021
Other articles |
Install
sudo apt update sudo apt install ansible
- Install plugins
ansible-galaxy collection install ansible.posix ansible-galaxy collection install community.general
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
ansible-galaxy collection install ansible.posix # when using ansible to set ssh key
- Run ansible playbook
ansible-playbook pb-hostname.yml
- options:
- -k (ssh pass)
- -K (password for sudo)