Set up ansible-playbook on Ubuntu 20.04

Installation

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

Version confirmation

ansible-playbook --version

Register with authorized_keys of the machine that runs Ansible

ssh-copy-id 128.22.133.120

When specifying the public key

--Something went wrong

cat ~/.ssh/vamdemickey.pem | ssh [email protected] -i ~/.ssh/vamdemickey.pem "cat >> ./.ssh/authorized_keys"

Write the execution destination IP address in hosts for ansible

[servers]
128.22.133.120

Connection confirmation

ansible 128.22.133.120 -m ping
128.22.133.120 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "ping": "pong"
}

Create playbook

wget.yml


- hosts: servers
  tasks:
    - name: install the latest version of wget
      yum:
        name: wget
        state: latest

Run

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   

reference

https://qiita.com/s-nishimaki/items/bd396b5ceaa9370d79c7

Recommended Posts

Set up ansible-playbook on Ubuntu 20.04
Set up an SSH server on WSL2 Ubuntu 20.04
Set up Gitolite on CentOS 7
[Ubuntu] Set up a Nukkit server
Set up a MineCraft Paper server on Ubuntu 20.04.1 LTS ② Update
Set up Django on Ubuntu 16.04 with PostgreSQL and Gunicorn on ECS
Set up ImpressPages 5.0 with LAMP on CentOS 7.3
Set up Docker Registry locally on CentOS 7
tmux on Ubuntu
Set up Metabase service on Windows Server 2012
Install Docker on Ubuntu and set up remote connection using tls
Minimal steps to set up a Ruby environment with rbenv on Ubuntu 20.04
Gachi beginners set up containers on Kubernetes? Until···
Screen recording on Ubuntu 20.04
Web Bluetooth on Ubuntu20.04
Try DisplayLink on Ubuntu 20.04
Reinstall Kubernetes on Ubuntu 19.10
Install pyqt5 on ubuntu
Install Ruby on Ubuntu 20.04
Setting JAVA_HOME on Ubuntu
Install Autoware on Ubuntu 18.04.5
Put JetBrains on Ubuntu
Use mkdir on ubuntu
Apache2 on Ubuntu20.04 LTS
Use cpplapack on ubuntu
ubuntu on wsl part 10
Install Homebrew on Ubuntu 20.04
Run tiscamera on Ubuntu 18.04
Build Zabbix on Ubuntu 20.04
Setting up the FreeBSD desktop environment on Ubuntu + qemu
Steps to set up Postfix and Dovecot on CentOS 8.3
Steps to set up a VNC server on CentOS 8.3
Using Flutter on Ubuntu (Part 2)
Create SSL certificate on Ubuntu 18.04
Building WebGIS on Ubuntu20.04 LTS
Install OpenJDK7 (JAVA) on ubuntu 14.04
Put Ubuntu 20.04.1 on Raspberry Pi 4
Build VNC Server on Ubuntu 20.04
Install Cybozu Office 10 on Ubuntu 20.4
Extend swap area on Ubuntu 18.04
Ubuntu on Windows Community Preview
Japanese input on Ubuntu20.04 Desktop
Oracle Java 8 on Docker Ubuntu
Install zabbix agent (5.0) on Ubuntu 18.04
Install MAV Proxy on Ubuntu 18.04
Install Arudino IDE on Ubuntu 20
Record video on ubuntu18.04 LTS
Introduced knowledge (wiki) on Ubuntu
Installing OpenMX on Ubuntu 18.04.5 LTS
Install Java on WSL Ubuntu 18.04
Ruby installation on WSL2 + Ubuntu 20.04
Install Ubuntu Desktop 20.10 on RaspberryPi4
Run chromium-mir-kiosk on Ubuntu Core
Install Arduino IDE on Ubuntu 20.04
Ubuntu on Windows build speed
Run java applet on ubuntu
Install raspi-config on Ubuntu 20.04 (LTS)
Install WordPress 5.5 on Ubuntu 20.04 LTS
Run Eclipse CDT on Ubuntu
Try setting up Talend Open Studio on Amazon EC2 (ubuntu)
Install PlantUML on Intellij on Ubuntu