Added base for k8s playbook repo

This commit is contained in:
Vlad R 2023-03-15 12:17:07 +00:00
parent 6f7d1f9bd3
commit 2a3edc6a62
6 changed files with 82 additions and 28 deletions

View File

@ -1,22 +0,0 @@
$ANSIBLE_VAULT;1.1;AES256
37666465316439393863333939643838623635333130646232353430343535623233636261343963
6463636434646265636535356132343031366536633633630a393830373865656532313466663937
33326237613537363739653837346165363466313430663262356134666530623135343234373034
3432306232626166330a643261353639653866633662633431376436626562343134316362326330
64643233303235303339353062323765643061626437393138613966386465376438616634373334
32626230346461633364613863356631653838616161333438383662623431353530306236306663
32376134623266623136316630373136653965336162646662393030386536353938323935393935
33303336653933393532663065653935643066636435616633613165613163643430326164336134
64653166633362666463306463336338663061346538326631393732623164326135616162613637
35313439613635623632326636326665626665633732626533323336366539623038623334323931
65383032643639623561666134393565343830326537323330373963363461663731366663643565
32306634343837626566376132643438633361613935323766383464303432366334663961353464
61313030663335613735656135666464353463313764393034616463383466363765303435363335
38316330393037616665666264633234613837663933333131306164663732326662663034613164
31663866333162643630383930353734646561326236656562666262653937623563646639343461
38396238323862613733313433306133313131353030623931666566613465353165643865316530
61623534326664653238356537326163633138336165653838653065393033363831373830386635
64336463333834393430376136373065653463323761643138346465386438343465333365663063
35353035333863373566623339363333633130343932353432616236656531663266363131663761
36393531313561333037343861623163393962613930306365363634356236306133643261313939
3834

View File

@ -6,4 +6,11 @@ all:
10.221.0.130:
10.221.0.131:
10.221.0.132:
kube_masters:
hosts:
10.221.0.130:
kube_workers:
hosts:
10.221.0.131:
10.221.0.132:

22
kubernetes/reboot.yml Normal file
View File

@ -0,0 +1,22 @@
---
- name: Reboots linux host and checks status
hosts: all
become: yes
vars_files:
- global_vars/main.yml
tasks:
- name: Rebooting...
ansible.builtin.reboot:
reboot_timeout: 180
msg: Reboot issued by Ansible
test_command: whoami
- name: Send Webex Teams message via BOT to confirm playbook completion
community.general.cisco_webex:
recipient_type: toPersonEmail
recipient_id: "{{ webex_id }}"
msg_type: markdown
personal_token: "{{ webex_token }}"
msg: "**Host {{ inventory_hostname }} has successfully rebooted.**"

View File

@ -1,9 +1,4 @@
---
- name: Update and upgrade current packages
ansible.builtin.apt:
update_cache: yes
upgrade: yes
- name: Create a user with sudo privileges which will be used for managing the host via SSH
ansible.builtin.user:
name: "{{ local_user }}"
@ -18,4 +13,4 @@
ansible.posix.authorized_key:
user: "{{ local_user }}"
state: present
key: "{{ local_key }}"
key: "{{ local_key }}"

View File

@ -0,0 +1,26 @@
$ANSIBLE_VAULT;1.1;AES256
34666666646666303864663337636430646134663430626232393462653163636561313335323063
3863656666303539323663356236396436643032313063630a386133333436623730313937363939
31633034386334393538303163326637343134656236346337313165313334373364366339643363
3531653935373836320a343362656638323631383139666265623935396634366461343839366164
65303239646462373062313263306638663736653830333963623936623930386530336362656631
31303135343631386464383964313834353034363036323035636337633563616237616631373361
33353836653538333461356632613138616232393961333866336363313036386431353937613331
32646263343661346461626233666565373631313539623464353037393163653133323034663730
35393363323366613631613931383633646330323866313462653833376631313535613738303366
66386632623135326461623761636162346637616436383266646337306562363764616630666134
37613137656233396365363236646363366566616630376430663431663231356436393762333233
38623161356634333761376461373636633731383165393538613030623436386133383361376539
38366465393464623636396266353463323631343062366464353034386639613530396264306365
39346261373766303236383032356337353936363362393935393062646233663633663964626436
61666362636366656633393630666536363235383162316366343666396361323032613065656237
38663262646362373331336139386164643566656566396561633437353731633630636264366339
35623136326334666263363130666466363565353337663832663239303066633137643965363233
36366165633433386238323365613766633836313735393666656330646439303230353330313737
61623965343034343732613933313332646330373466353235343736646664343531303138613665
66313061356332396263636465626462616435626565656335626363666530346231343864663134
66393839653236376561626331313836356334616237353437306139626164613731373864383530
33383131336338346233353030636230626664663134663939373434636630306663346534393062
32626662666338623964363239663231646563626265616337353333623630346438643338333630
30396134653134326136303639366139363866336564323537303238346630333761346133326163
6631

View File

@ -0,0 +1,26 @@
---
- name: Shuts down K8s services on nodes and master
hosts: kubernetes
become: yes
gather_facts: yes
roles:
- common
tasks:
- name: Collect cluster status
ansible.builtin.shell: |
kubectl get nodes
kubectl get namespaces
kubectl get pods -A
kubectl get pv
kubectl get pvc -A
kubectl get secrets -A
kubectl get ingress -A
when: ('kube_masters' in group_names)
# - name: Rebooting...
# ansible.builtin.reboot:
# reboot_timeout: 180
# msg: Reboot issued by Ansible
# test_command: whoami