sudo apt update -y
sudo apt install -y software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install -y ansible
ansible-playbook --version
ssh-copy-id 128.22.133.120
--Something went wrong
cat ~/.ssh/vamdemickey.pem | ssh [email protected] -i ~/.ssh/vamdemickey.pem "cat >> ./.ssh/authorized_keys"
[servers]
128.22.133.120
ansible 128.22.133.120 -m ping
128.22.133.120 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
wget.yml
- hosts: servers
tasks:
- name: install the latest version of wget
yum:
name: wget
state: latest
ansible-playbook wget.yaml
PLAY [servers] ************************************************************************************************
TASK [Gathering Facts] ****************************************************************************************
ok: [128.22.133.120]
TASK [install the latest version of wget] *********************************************************************
ok: [128.22.133.120]
PLAY RECAP ****************************************************************************************************
128.22.133.120 : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignore
d=0
https://qiita.com/s-nishimaki/items/bd396b5ceaa9370d79c7
Recommended Posts