Die Übersetzung des Artikels wurde am Vorabend des Kurses "Infrastrukturplattform basierend auf Kubernetes" vorbereitet .
Ich schlage vor, Sie krempeln die Ärmel hoch und tauchen mit AWS EC2 in Ansible-Aufgaben ein. Wir werden durch die Installation und Deinstallation eines Pakets mit Ansible gehen.
RnD VizuaMatix c ansible. Ansible - - , YouTube ansible . , Ansible. Ansible AWS EC2.
(master node, “”) (worker node, “”) . Ubuntu 18.04.4. . VLC , .
Ansible (-). :
sudo apt install ansible
. ssh- .
ssh-keygen -t rsa -N “” -f /home/ubuntu/.ssh/idrsa
cat
cat .ssh/idrsa.pub
vim ~/.ssh/authorized_keys
, . .
, :
ssh -i ~/.ssh/id_rsa username@instance_ip
, .
ansible. /etc/ansible/hosts
. [workers]
. , workers
playbook, ansible , playbook.
[workers]
[workers]
node_ip_address
, : ansible workers -m ping
, SUCCESS
pong
| SUCCESS => {
"changed": false,
"ping": "pong"
}
- , . AWS-EC2 Ansible. VLC.
Playbook
Ansible playbook. yaml
. playbooks ansible.
playbook vlc: installvlc.yaml
---
- name: installvlc # playbook
hosts: workers #
become: true # sudo user
tasks:
- name: Install VLC Media Player
apt: #
name: vlc-bin
state: latest
# , state: 3.0.0
playbook ,
ansible-playbook installvlc.yaml
, - :
PLAY [installvlc] *********************************************************************************************************************
TASK [Gathering Facts] ****************************************************************************************************************
ok: []
TASK [Install VLC Media Player] *******************************************************************************************************
changed: []
PLAY RECAP ****************************************************************************************************************************
: ok=2 changed=1 unreachable=0 failed=0
changed=1
, playbook . playbook, changed=0
. , (state) .
: vlc
, - VLC media player 3.0.8 Vetinari (revision 3.0.8–0-gf350b6b5a7)
.
Playbook
, , , :
state: absent
playbook , state . , . playbook ansible-playbook uninstallvlc.yaml
Ansible - . , yaml
playbook. , ansible , IoT .
, ansible. , , . .