AWSおよびEC2で対応可能

記事の翻訳は、コース「Kubernetesに基づくインフラストラクチャプラットフォーム」の開始前夜に作成されました


AWS EC2を使用して、袖をまくり上げてAnsibleタスクに飛び込むことをお勧めします。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. , , . .


Demo- : " Kubernetes"





All Articles