-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.org~
63 lines (59 loc) · 1.7 KB
/
README.org~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#+TITLE: Roteiro Kubernetes
Versão 0.2
#+begin_src sh :results none
chmod +x *.sh
#+end_src
* Clonar VMs
* SSH
** Cria chaves assimétricas
#+begin_src sh :tangle create_keys.sh
HOSTS=(10.20.1.247 10.20.1.249)
# Cria as chaves
mkdir ~/.ssh
ssh-keygen -q -t rsa -b 4096 -f ~/.ssh/id_rsa -P ""
# Copia chave pública para os hosts remotos
for HOST in "${HOSTS[@]}"; do
ssh-keyscan -H $HOST >> ~/.ssh/known_hosts
ssh-copy-id $USER@$HOST
done
echo "Teste o ssh."
#+end_src
* Instalar Ansible e Git
#+begin_src sh :tangle install-deps.sh
sudo dnf install python39 -y
sudo dnf install python3-pip -y
sudo dnf install git -y
pip3 install --upgrade pip
#+end_src
* Atualizar sistemas
Comando para executar o playbook para atualizar o sistema operacional
dos hosts.
#+begin_src sh :tangle update-systems.sh
ansible-playbook -i ./inventory.ini update-systems-playbook.yaml --ask-become-pass
#+end_src
Playbook ansible especificando o que se deve fazer, nesse caso,
atualizar os softwares presentes nos hosts.
#+begin_src text :tangle update-systems-playbook.yaml
- name: Atualiza sistema
hosts: server*
become: true
tasks:
- name: Atualiza sistema
package:
name: '*'
state: latest
#+end_src
Inventário contendo configuração para acesso aos hosts.
#+begin_src text :tangle inventory.ini
server1 ansible_host=10.20.1.247 ansible_user=igor
server2 ansible_host=10.20.1.249 ansible_user=igor
#+end_src
* Clonar repositório do Kubespray
#+begin_src sh :tangle install-kubespray.sh
cd ~
mkdir repos
cd repos
git clone https://github.com/kubernetes-sigs/kubespray
cd kubespray
pip3 install -r requirementes.txt
#+end_src