From 6f7d1f9bd377bd1fde5f65acb0fb70f3ff5693fe Mon Sep 17 00:00:00 2001 From: Vlad R Date: Wed, 15 Mar 2023 12:13:51 +0000 Subject: [PATCH] Added base for k8s playbook repo --- dnaclab_linux/inventory.yml | 17 +++++------------ dnaclab_linux/reboot.yml | 4 ++-- kubernetes/common/tasks/main.yml | 21 +++++++++++++++++++++ kubernetes/common/vars/main.yml | 22 ++++++++++++++++++++++ kubernetes/inventory.yml | 9 +++++++++ 5 files changed, 59 insertions(+), 14 deletions(-) create mode 100644 kubernetes/common/tasks/main.yml create mode 100644 kubernetes/common/vars/main.yml create mode 100644 kubernetes/inventory.yml diff --git a/dnaclab_linux/inventory.yml b/dnaclab_linux/inventory.yml index d406d67..8c00978 100644 --- a/dnaclab_linux/inventory.yml +++ b/dnaclab_linux/inventory.yml @@ -4,22 +4,15 @@ all: services: hosts: ubuntu.dnaclab.net: - telemetry: - hosts: - telemetry.dnaclab.net: developer: hosts: developer.dnaclab.net: gitlab: hosts: gitlab.dnaclab.net: - test: + kubernetes: hosts: - test.dnaclab.net: - all_servers: - hosts: - ubuntu.dnaclab.net: - telemetry.dnaclab.net: - developer.dnaclab.net: - gitlab.dnaclab.net: - test.dnaclab.net: + 10.221.0.130: + 10.221.0.131: + 10.221.0.132: + diff --git a/dnaclab_linux/reboot.yml b/dnaclab_linux/reboot.yml index c80d0b0..5f3dd6d 100644 --- a/dnaclab_linux/reboot.yml +++ b/dnaclab_linux/reboot.yml @@ -1,6 +1,6 @@ --- - name: Reboots linux host and checks status - hosts: all_servers + hosts: all become: yes vars_files: - global_vars/main.yml @@ -19,4 +19,4 @@ recipient_id: "{{ webex_id }}" msg_type: markdown personal_token: "{{ webex_token }}" - msg: "**Host {{ inventory_hostname }} has successfully rebooted.**" \ No newline at end of file + msg: "**Host {{ inventory_hostname }} has successfully rebooted.**" diff --git a/kubernetes/common/tasks/main.yml b/kubernetes/common/tasks/main.yml new file mode 100644 index 0000000..177b084 --- /dev/null +++ b/kubernetes/common/tasks/main.yml @@ -0,0 +1,21 @@ +--- +- 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 }}" + state: present + groups: sudo + append: true + create_home: true + shell: /bin/bash + password: "{{ local_password }}" + +- name: Set authorized key for remote SSH access (passwordless login) + ansible.posix.authorized_key: + user: "{{ local_user }}" + state: present + key: "{{ local_key }}" \ No newline at end of file diff --git a/kubernetes/common/vars/main.yml b/kubernetes/common/vars/main.yml new file mode 100644 index 0000000..87f5e23 --- /dev/null +++ b/kubernetes/common/vars/main.yml @@ -0,0 +1,22 @@ +$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 diff --git a/kubernetes/inventory.yml b/kubernetes/inventory.yml new file mode 100644 index 0000000..f845df9 --- /dev/null +++ b/kubernetes/inventory.yml @@ -0,0 +1,9 @@ +--- +all: + children: + kubernetes: + hosts: + 10.221.0.130: + 10.221.0.131: + 10.221.0.132: +