From f663a6a498683f781c8fa619455f1ca7004dcfd3 Mon Sep 17 00:00:00 2001 From: ngyimesi <norbi@gyimesiek.hu> Date: Wed, 14 Sep 2022 16:39:11 +0200 Subject: [PATCH] New vsalgo config --- ansible.cfg | 5 +-- bootstrap.sh | 11 ------ install.yml | 13 +++++-- inventory.yml | 12 +++--- requirements.galaxy.yml | 6 ++- tasks/create_users.yml | 20 ++++++++++ tasks/kszk-host.yml | 14 +++++++ tasks/net.yml | 11 +----- tasks/upgrade.yml | 5 +++ templates/interfaces | 81 ----------------------------------------- 10 files changed, 63 insertions(+), 115 deletions(-) delete mode 100755 bootstrap.sh create mode 100644 tasks/create_users.yml create mode 100644 tasks/kszk-host.yml create mode 100644 tasks/upgrade.yml delete mode 100644 templates/interfaces diff --git a/ansible.cfg b/ansible.cfg index e5e6db3..ec0022e 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,7 +1,6 @@ [defaults] inventory = inventory.yml forks = 300 +#strategy = free nocows=1 - -[ssh_connection] -retries=2 \ No newline at end of file +cow_selection=stegosaurus \ No newline at end of file diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100755 index 09e3594..0000000 --- a/bootstrap.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -AUTH="bootstrapper:6cDoVsyYzzDE6fLi5MTB" - -git clone \ - https://${AUTH}@git.sch.bme.hu/kszk/sysadmin/ansible/ansci.git \ - .template \ - || (cd .template && git pull) - -exec .template/playbook-template/bootstrap.sh - diff --git a/install.yml b/install.yml index 8b0cf95..9fb7b9f 100644 --- a/install.yml +++ b/install.yml @@ -1,7 +1,14 @@ --- - hosts: all - tags: net + tags: bootstrap tasks: - - name: Set up network + #- name: Install kszk-host stuff + # import_tasks: tasks/kszk-host.yml + - name: Upgrade + import_tasks: tasks/upgrade.yml + - name: Install network utils import_tasks: tasks/net.yml - + - name: User setup + import_tasks: tasks/create_users.yml + - name: Other useful packages + import_tasks: tasks/other-packages.yml diff --git a/inventory.yml b/inventory.yml index 88312b6..87f5594 100644 --- a/inventory.yml +++ b/inventory.yml @@ -1,17 +1,17 @@ all: hosts: - node1.vsalgo: + vsalgo-1: cluster_ip: 10.42.0.101/24 admin_ip: 10.0.42.101/16 internal_ip: 10.151.42.101/16 - node2.vsalgo: + ansible_user: root + vsalgo-2: cluster_ip: 10.42.0.102/24 admin_ip: 10.0.42.102/16 internal_ip: 10.151.42.102/16 - node3.vsalgo: + ansible_user: root + vsalgo-3: cluster_ip: 10.42.0.103/24 admin_ip: 10.0.42.103/16 internal_ip: 10.151.42.103/16 - - - + ansible_user: root diff --git a/requirements.galaxy.yml b/requirements.galaxy.yml index 7265dc5..db6e887 100644 --- a/requirements.galaxy.yml +++ b/requirements.galaxy.yml @@ -1,2 +1,6 @@ --- -roles: [] +roles: + - src: git@git.sch.bme.hu:kszk/ansible/roles/kszk_host.git + scm: git + ref: 0.1.0 + name: kszk.host diff --git a/tasks/create_users.yml b/tasks/create_users.yml new file mode 100644 index 0000000..2964cf6 --- /dev/null +++ b/tasks/create_users.yml @@ -0,0 +1,20 @@ +- name: create user + user: + name: "{{ item }}" + state: present + groups: [ sudo ] + create_home: yes + shell: /bin/bash + with_items: + - norbey + - mike + +- name: add key + authorized_key: + user: "{{ item.name }}" + key: "{{ item.key }}" + with_items: + - name: norbey + key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJJ6Rp2ETGHzEfyQZsR4Ac0iJUrtytLi2C7MZIiiCcug norbey@hellothere + - name: mike + key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBVHRlgZ+UTSBCChrpYTzOhLek9r9CcoNPoE2EcFXvz0 mike@curiosity diff --git a/tasks/kszk-host.yml b/tasks/kszk-host.yml new file mode 100644 index 0000000..a8efa8b --- /dev/null +++ b/tasks/kszk-host.yml @@ -0,0 +1,14 @@ +--- +- name: Install kszk-host role + roles: + - { role: kszk.host } + #- { role: jmcvetta.passwordless-sudo } + vars: + motd_playbook_url: "https://git.sch.bme.hu/kszk/sysadmin/vsalgo-ansible" + users: [] + ssh: + port: 22 + passwordAuthentication: "yes" + pubkeyAuthentication: "yes" + permitRootLogin: "yes" + no_iptables: yes \ No newline at end of file diff --git a/tasks/net.yml b/tasks/net.yml index cab52b6..ea22fc2 100644 --- a/tasks/net.yml +++ b/tasks/net.yml @@ -5,13 +5,4 @@ - ifupdown2 - libpve-network-perl - openvswitch-switch - -- name: Template network config - template: - src: interfaces - dest: /etc/network/interfaces - register: interfaces - -- name: Reload ifupdown2 - command: ifreload -a - when: interfaces.changed \ No newline at end of file + state: present diff --git a/tasks/upgrade.yml b/tasks/upgrade.yml new file mode 100644 index 0000000..5220bee --- /dev/null +++ b/tasks/upgrade.yml @@ -0,0 +1,5 @@ +--- +- name: Upgrade nodes + apt: + update_cache: yes + upgrade: yes diff --git a/templates/interfaces b/templates/interfaces deleted file mode 100644 index eb5ad88..0000000 --- a/templates/interfaces +++ /dev/null @@ -1,81 +0,0 @@ -# network interface settings; autogenerated -# Please do NOT modify this file directly, unless you know what -# you're doing. -# -# If you want to manage parts of the network configuration manually, -# please utilize the 'source' or 'source-directory' directives to do -# so. -# PVE will preserve these directives, but will NOT read its network -# configuration from sourced files, so do not attempt to move any of -# the PVE managed interfaces into external files! - -auto lo -iface lo inet loopback - -auto enp3s0f0 -iface enp3s0f0 inet manual - mtu 9000 - dns-nameservers 152.66.208.1 - dns-search internal -#Bal lent - -auto enp3s0f1 -iface enp3s0f1 inet manual - mtu 9000 -#Bal fent - -auto enp4s0f0 -iface enp4s0f0 inet manual - mtu 9000 -#Jobb oldali - -auto enp4s0f1 -iface enp4s0f1 inet manual - mtu 9000 -#Középső - -auto bond0 -iface bond0 inet manual - ovs_bonds enp3s0f0 enp3s0f1 enp4s0f0 enp4s0f1 - ovs_type OVSBond - ovs_bridge vmbr0 - ovs_mtu 9000 - ovs_options bond_mode=balance-slb -#Main bond - -auto vmbr0 -iface vmbr0 inet manual - ovs_type OVSBridge - ovs_ports bond0 vlan10 vlan151 vlan420 - ovs_mtu 9000 -#Main vSwitch - - -auto vlan10 -iface vlan10 inet static - address {{ admin_ip }} - ovs_type OVSIntPort - ovs_bridge vmbr0 - ovs_mtu 9000 -#AdminLAN - -auto vlan151 -iface vlan151 inet static - address {{ internal_ip }} - gateway 10.151.255.254 - ovs_type OVSIntPort - ovs_bridge vmbr0 - ovs_mtu 9000 - ovs_options tag=151 -#Internal with :80 and :443 NAT - -auto vlan420 -iface vlan420 inet static - address {{ cluster_ip }} - ovs_type OVSIntPort - ovs_bridge vmbr0 - ovs_mtu 9000 - ovs_options tag=420 -#Cluster network - -source /etc/network/interfaces.d/* -- GitLab