datta/playbooks/sunet.yaml

104 lines
3.3 KiB
YAML
Raw Normal View History

2023-11-13 10:27:39 +00:00
---
- name: Set up various work related stuff
hosts: localhost
vars:
uid: "{{ lookup('env','USER') }}"
gitops: git+ssh://git@gitops.sunet.se
2024-01-11 09:52:57 +01:00
github: git+ssh://git@github.com/SUNET
helm_version: 3.13.3
2023-11-13 16:46:48 +01:00
platform: git+ssh://git@platform.sunet.se:22022/Drive
2023-11-13 17:44:05 +01:00
commands:
- get_drive_customers
- get_drive_servers
2023-11-13 10:27:39 +00:00
opsrepos:
- sunet-drive-ops
- mail-ops
- platform-ops
2023-11-13 16:46:48 +01:00
puppetrepos:
- puppet-sunet
platformrepos:
- sunetdrive
2023-11-14 15:58:22 +01:00
dockerrepos:
- nextcloud-custom
- dovecot-lda-docker
- postfix-docker
2023-11-13 10:27:39 +00:00
connection: local
become: false
tasks:
2023-11-23 12:25:15 +01:00
- name: Create sunet config folder
ansible.builtin.file:
dest: /home/{{ uid }}/.config/sunet
state: directory
2023-11-13 10:27:39 +00:00
- name: Create sunet folders
ansible.builtin.file:
dest: /home/{{ uid }}/sunet/{{ item }}
state: directory
loop:
- docker
- ops
- puppet
- name: Get gitops ops-repos
ansible.builtin.command:
2023-11-13 16:46:48 +01:00
chdir: /home/{{ uid }}/sunet/ops
2023-11-13 10:27:39 +00:00
cmd: git clone {{ gitops }}/{{ item }}
creates: /home/{{ uid }}/sunet/ops/{{ item }}
loop: "{{ opsrepos }}"
2023-11-13 16:46:48 +01:00
- name: Get github puppet-repos
ansible.builtin.command:
chdir: /home/{{ uid }}/sunet/puppet
cmd: git clone {{ github }}/{{ item }}
creates: /home/{{ uid }}/sunet/puppet/{{ item }}
loop: "{{ puppetrepos }}"
2023-11-14 15:58:22 +01:00
- name: Get github docker-repos
ansible.builtin.command:
chdir: /home/{{ uid }}/sunet/docker
cmd: git clone {{ github }}/{{ item }}
creates: /home/{{ uid }}/sunet/docker/{{ item }}
loop: "{{ dockerrepos }}"
2023-11-13 16:46:48 +01:00
- name: Get platform puppet-repos
ansible.builtin.command:
chdir: /home/{{ uid }}/sunet/puppet
cmd: git clone {{ platform }}/{{ item }}
creates: /home/{{ uid }}/sunet/puppet/{{ item }}
loop: "{{ platformrepos }}"
2023-11-13 17:44:05 +01:00
- name: Install sunet programs
ansible.builtin.file:
src: /home/{{ uid }}/sunet/ops/sunet-drive-ops/{{item}}
dest: /home/{{ uid }}/.local/bin/{{ item }}
state: link
loop: "{{ commands }}"
2023-11-23 13:23:06 +01:00
- name: Add tsocks.conf
ansible.builtin.template:
src: ../templates/tsocks.conf.j2
dest: /etc/tsocks.conf
become: true
2024-01-11 09:52:57 +01:00
- name: Have helm allready installed
stat:
path: /usr/local/bin/helm
register: have_helm
- name: Get helm
ansible.builtin.command:
chdir: /tmp
cmd: wget https://get.helm.sh/helm-v{{ helm_version }}-linux-amd64.tar.gz
creates: /tmp/helm-v{{ helm_version }}-linux-amd64.tar.gz
when: not have_helm.stat.exists
- name: Unpack helm
ansible.builtin.command:
chdir: /tmp
cmd: tar xfv helm-v{{ helm_version }}-linux-amd64.tar.gz
creates: /tmp/linux-amd64/helm
when: not have_helm.stat.exists
- name: Install helm
ansible.builtin.command:
chdir: /tmp
cmd: mv /tmp/linux-amd64/helm /usr/local/bin
creates: /usr/local/bin/helm
become: true
when: not have_helm.stat.exists
- name: cleanup helm
ansible.builtin.command:
chdir: /tmp
cmd: rm -rf /tmp/helm-v{{ helm_version }}-linux-amd64.tar.gz /tmp/linux-amd64
when: not have_helm.stat.exists