La traduction de l'article a été préparée à la veille du début du cours "Plateforme d'infrastructure basée sur Kubernetes" .
Je vous suggère de retrousser vos manches et de vous plonger dans les tâches Ansible en utilisant AWS EC2. Nous expliquerons comment installer et désinstaller un package à l'aide d'Ansible.
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. , , . .