ansible-infra/collections/ansible_collections/nullified/infrastructure/roles/provisioner/tasks/main.yml

57 lines
1.8 KiB
YAML

---
# add https://github.com/databus23/helm-diff
- name: set default facts
ansible.builtin.set_fact:
provisioner_playbook_user: '{{ lookup("env", "USER") }}'
changed_when: false
- name: install helm
ansible.builtin.include_role:
name: nullified.infrastructure.helm
vars:
helm_binary_path: '{{ provisioner_helm_binary_path }}'
helm_install_version: '{{ provisioner_helm_version }}'
- name: install kubectl
ansible.builtin.include_role:
name: nullified.infrastructure.kubectl
vars:
kubectl_binary_path: '{{ provisioner_kubectl_binary_path }}'
kubectl_install_version: '{{ provisioner_kubectl_version }}'
- name: install OpenTofu
become: true
nullified.infrastructure.github_artifact:
github_token: '{{ provisioner_github_token }}'
asset_name: 'tofu_{version}_amd64.deb'
asset_type: release
creates: '{{ provisioner_tofu_binary_path }}' # path used by the .deb, no control over it
repository: opentofu/opentofu
force: true
cmds:
- 'dpkg -i {asset_dirname}/{asset_filename}'
- name: retrieve k3sup on Ansible controller
become: true
nullified.infrastructure.github_artifact:
asset_name: k3sup
asset_type: release
repository: alexellis/k3sup
github_token: "{{ provisioner_github_token }}"
creates: '{{ provisioner_k3sup_binary_path }}'
force: true
cmds:
- "install --mode=755 {asset_dirname}/{asset_filename} {{ provisioner_k3sup_binary_path }}"
- name: create storage directories
become: true
ansible.builtin.file:
path: '{{ item }}'
mode: '0700'
owner: '{{ provisioner_playbook_user }}'
group: '{{ provisioner_playbook_user }}'
state: directory
loop:
- '{{ provisioner_artifacts_dir }}'
- '{{ provisioner_k8s_states_dir }}'
- '{{ provisioner_kubeconfig_repository }}'