mirror of
https://github.com/PyratLabs/ansible-role-k3s.git
synced 2024-11-22 11:48:22 +01:00
Added database container and proved connectivity. Logic needs to be changed for HA.
This commit is contained in:
parent
734e49a7e5
commit
c3ae2b79eb
@ -34,6 +34,10 @@ env:
|
||||
- MOLECULE_DISTRO: geerlingguy/docker-fedora31-ansible:latest
|
||||
MOLECULE_PLAYBOOK: playbook-no-deploy.yml
|
||||
|
||||
# Test multiple masters in control plane with PostgreSQL
|
||||
- MOLECULE_DISTRO: geerlingguy/docker-centos8-ansible:latest
|
||||
MOLECULE_PLAYBOOK: playbook-ha-postgres.yml
|
||||
|
||||
install:
|
||||
# Install test dependencies.
|
||||
- pip install molecule docker jmespath
|
||||
|
@ -34,6 +34,14 @@ platforms:
|
||||
pre_build_image: ${MOLECULE_PREBUILT:-true}
|
||||
networks:
|
||||
- name: k3snet
|
||||
- name: database
|
||||
image: postgres:11-alpine
|
||||
pre_build_image: true
|
||||
command: "postgres"
|
||||
env:
|
||||
POSTGRES_PASSWORD: "verybadpass"
|
||||
networks:
|
||||
- name: k3snet
|
||||
provisioner:
|
||||
name: ansible
|
||||
options:
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
hosts: node*
|
||||
become: true
|
||||
vars:
|
||||
molecule_is_test: true
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
hosts: node*
|
||||
become: true
|
||||
vars:
|
||||
molecule_is_test: true
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
hosts: node*
|
||||
become: true
|
||||
vars:
|
||||
molecule_is_test: true
|
||||
|
13
molecule/default/playbook-ha-postgres.yml
Normal file
13
molecule/default/playbook-ha-postgres.yml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: node*
|
||||
become: true
|
||||
vars:
|
||||
molecule_is_test: true
|
||||
k3s_datastore_endpoint: "postgres://postgres:verybadpass@database:5432/postgres?sslmode=disable"
|
||||
pre_tasks:
|
||||
- name: Set each node to be a control node
|
||||
set_fact:
|
||||
k3s_control_node: true
|
||||
roles:
|
||||
- role: xanmanning.k3s
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
hosts: node*
|
||||
become: true
|
||||
vars:
|
||||
molecule_is_test: true
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
hosts: node*
|
||||
become: true
|
||||
vars:
|
||||
molecule_is_test: true
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
hosts: node*
|
||||
become: true
|
||||
vars:
|
||||
molecule_is_test: true
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
hosts: node*
|
||||
become: true
|
||||
vars:
|
||||
molecule_is_test: true
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
hosts: node*
|
||||
become: true
|
||||
vars:
|
||||
molecule_is_test: true
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
hosts: node*
|
||||
become: true
|
||||
vars:
|
||||
molecule_is_test: true
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Prepare
|
||||
hosts: all
|
||||
hosts: node1
|
||||
become: true
|
||||
tasks:
|
||||
- name: Ensure a user group exists
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Prepare
|
||||
hosts: all
|
||||
hosts: node*
|
||||
tasks:
|
||||
- name: Debug Message
|
||||
debug:
|
||||
|
@ -4,7 +4,7 @@
|
||||
assert:
|
||||
that:
|
||||
- k3s_use_experimental is defined and k3s_use_experimental
|
||||
- k3s_dqlite_datastore is defined and k3s_use_experimental
|
||||
success_msg: "Experimental variables are defined and enabled."
|
||||
fail_msg: "Experimental variables have been configured. If you want to use them ensure you set k3s_use_experimental"
|
||||
when: k3s_non_root is defined and k3s_non_root
|
||||
when: (k3s_non_root is defined and k3s_non_root)
|
||||
or (k3s_dqlite_datastore is defined and k3s_dqlite_datastore)
|
||||
|
@ -54,6 +54,9 @@ ExecStart={{ k3s_install_dir }}/k3s
|
||||
{% if k3s_cluster_domain is defined and k3s_cluster_domain != "cluster.local" %}
|
||||
--cluster-domain {{ k3s_cluster_domain }}
|
||||
{% endif %}
|
||||
{% if k3s_datastore_endpoint is defined and k3s_datastore_endpoint %}
|
||||
--datastore-endpoint "{{ k3s_datastore_endpoint }}"
|
||||
{% endif %}
|
||||
{% else %}
|
||||
agent
|
||||
--server https://{{ k3s_control_node_address }}:{{ k3s_https_port }}
|
||||
|
Loading…
Reference in New Issue
Block a user