fix(airgap): moved from vars to defaults

This commit is contained in:
Xan Manning 2022-01-02 21:10:48 +00:00
parent 3be75a8296
commit 377565de96
7 changed files with 23 additions and 6 deletions

View file

@ -28,8 +28,6 @@ jobs:
scenario: default scenario: default
- distro: amazonlinux2 - distro: amazonlinux2
scenario: default scenario: default
- distro: centos7
scenario: default
- distro: ubuntu1804 - distro: ubuntu1804
scenario: default scenario: default
- distro: fedora33 - distro: fedora33

View file

@ -29,6 +29,9 @@ k3s_github_url: https://github.com/k3s-io/k3s
# URL for K3s updates API # URL for K3s updates API
k3s_api_url: https://update.k3s.io k3s_api_url: https://update.k3s.io
# Install K3s in Air Gapped scenarios
k3s_airgap: false
# Skip all tasks that validate configuration # Skip all tasks that validate configuration
k3s_skip_validation: false k3s_skip_validation: false

1
molecule/nodeploy/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
files/*

View file

@ -6,5 +6,6 @@
molecule_is_test: true molecule_is_test: true
k3s_server: "{{ lookup('file', 'k3s_server.yml') | from_yaml }}" k3s_server: "{{ lookup('file', 'k3s_server.yml') | from_yaml }}"
k3s_agent: "{{ lookup('file', 'k3s_agent.yml') | from_yaml }}" k3s_agent: "{{ lookup('file', 'k3s_agent.yml') | from_yaml }}"
k3s_airgap: true
roles: roles:
- role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}" - role: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"

View file

@ -8,3 +8,20 @@
state: present state: present
update_cache: true update_cache: true
when: ansible_pkg_mgr == 'apt' when: ansible_pkg_mgr == 'apt'
- name: Prepare air-gapped installation
delegate_to: localhost
run_once: true
block:
- name: Ensure files directory exists
ansible.builtin.file:
path: ./files
state: directory
mode: 0750
- name: Ensure k3s is downloaded for air-gap installation
ansible.builtin.get_url:
url: https://github.com/k3s-io/k3s/releases/download/v1.22.5%2Bk3s1/k3s
dest: ./files/k3s
mode: 0755

View file

@ -6,7 +6,7 @@
state: directory state: directory
mode: 0755 mode: 0755
- name: Copy local k3s binary to target host - name: Ensure k3s binary is copied from controller to target host
ansible.builtin.copy: ansible.builtin.copy:
src: k3s src: k3s
# TODO: allow airgap to bypass version post-fix # TODO: allow airgap to bypass version post-fix

View file

@ -55,9 +55,6 @@ k3s_api_releases: "{{ k3s_api_url }}/v1-release/channels"
# Download location for releases # Download location for releases
k3s_github_download_url: "{{ k3s_github_url }}/releases/download" k3s_github_download_url: "{{ k3s_github_url }}/releases/download"
# Install K3s in Air Gapped scenarios
k3s_airgap: false
# Generate a runtime config dictionary for validation # Generate a runtime config dictionary for validation
k3s_runtime_config: "{{ (k3s_server | default({})) | combine (k3s_agent | default({})) }}" k3s_runtime_config: "{{ (k3s_server | default({})) | combine (k3s_agent | default({})) }}"