commit 034e8ef0a73ae94d5c78411e20edad6392705534 Author: marcsello Date: Tue Nov 9 01:13:48 2021 +0100 meme diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..294d4d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vault_password_file +venv/ \ No newline at end of file diff --git a/inventory.yaml b/inventory.yaml new file mode 100644 index 0000000..2d5abfb --- /dev/null +++ b/inventory.yaml @@ -0,0 +1,11 @@ +all: + vars: + ansible_become: true + ansible_user: ubuntu + hosts: + kube-master-luna: + kube-worker-luna: + kube-master-mckay: + kube-worker-mckay: + kube-master-woolsey: + kube-worker-woolsey: \ No newline at end of file diff --git a/prepare.yaml b/prepare.yaml new file mode 100644 index 0000000..742c1f1 --- /dev/null +++ b/prepare.yaml @@ -0,0 +1,15 @@ +- name: "prepare vms for kmlabs-k8s-cluster" + hosts: all + + tasks: + - name: "do apt stuff" + import_tasks: tasks/apt.yaml + + - name: "disable cloudinit" + import_tasks: tasks/disable-cloudinit.yaml + + - name: "remove snap" + import_tasks: tasks/remove-snap.yaml + + - name: "clean motd" + import_tasks: tasks/clean-motd.yaml \ No newline at end of file diff --git a/tasks/apt.yaml b/tasks/apt.yaml new file mode 100644 index 0000000..32d9fcb --- /dev/null +++ b/tasks/apt.yaml @@ -0,0 +1,28 @@ +- name: "Remove ubuntu stuff" + apt: + state: absent + name: ubutu-server + autoremove: yes + +- name: "Install my favourite applications" + apt: + state: present + name: + - tmux + - htop + - dnsutils + - needrestart + - curl + - wget + - netcat-openbsd + - tree + - net-tools + - nano + - psmisc + - python3 + - python3-venv + - strace + - ifstat + - tcpdump + - xxd + - git \ No newline at end of file diff --git a/tasks/clean-motd.yaml b/tasks/clean-motd.yaml new file mode 100644 index 0000000..09df8bd --- /dev/null +++ b/tasks/clean-motd.yaml @@ -0,0 +1,13 @@ +# This changes permissions so update motd can not read it +- name: clean motd + file: + state: file + path: /etc/update-motd.d/{{ item }} + owner: root + group: root + mode: "0000" + with_items: + - 10-help-text + - 50-landscape-sysinfo + - 50-motd-news + - 91-release-upgrade \ No newline at end of file diff --git a/tasks/disable-cloudinit.yaml b/tasks/disable-cloudinit.yaml new file mode 100644 index 0000000..f08e3e6 --- /dev/null +++ b/tasks/disable-cloudinit.yaml @@ -0,0 +1,12 @@ +- name: disable cloudinit + copy: + content: "" + dest: /etc/cloud/cloud-init.disabled + force: no + +- name: disable network autoconfig + copy: + content: "network: {config: disabled}" + dest: /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg + force: no + diff --git a/tasks/remove-snap.yaml b/tasks/remove-snap.yaml new file mode 100644 index 0000000..5fbd049 --- /dev/null +++ b/tasks/remove-snap.yaml @@ -0,0 +1,17 @@ +- name: Remove snapd from Ubuntu + apt: + name: snapd + state: absent + purge: yes + when: ansible_distribution == "Ubuntu" + +- name: Remove snapd-related directories + file: + path: "{{ item }}" + state: absent + with_items: + - /snap + - /var/snap + - /var/lib/snapd + - "/home/{{ ansible_user }}/snap" + when: ansible_distribution == "Ubuntu" \ No newline at end of file