Skip to content
Snippets Groups Projects
Verified Commit 18b964db authored by Maarten de Waard's avatar Maarten de Waard :angel:
Browse files

separate playbooks for Kubernetes and OpenAppStack (re-)installation

parent 5f1c1229
Branches
Tags
No related merge requests found
......@@ -132,7 +132,7 @@ setup-openappstack:
- cp clusters/${CI_COMMIT_REF_SLUG}/inventory.yml ansible/
- cp clusters/${CI_COMMIT_REF_SLUG}/group_vars/all/settings.yml ansible/group_vars/all/
# Set up cluster
- python3 -m openappstack $HOSTNAME install
- python3 -m openappstack $HOSTNAME install --install-kubernetes
# Show versions of installed apps/binaries
- cd ansible
- ansible master -m shell -a 'oas-version-info.sh 2>&1'
......
---
- name: Run compatibility checks
hosts: all
gather_facts: false
pre_tasks:
- import_role:
name: compatibility-checks
- name: Pre-configure hosts
hosts: all
# We use `mitogen_linear` as default strategy. However,
# mitogen fails installing the `openshift` python module as requirement
# for the `k8s` ansible resource, and using `k8s` in the same context.
# That's why we use the standard `linear` ansible strategy for this role.
# See https://open.greenhost.net/openappstack/openappstack/issues/102
strategy: linear
roles:
- role: pre-configure
tags: ['pre-configure']
- name: Install Kubernetes
hosts: master
tasks:
- name: Configure VPS to run Kubernetes securely and install it
block:
- import_role:
name: configure
tags: ['configure']
- import_role:
name: setup-kubernetes
tags: ['setup-kubernetes']
always:
- import_role:
name: finalize
tags: ['finalize']
---
- name: Run compatibility checks
hosts: all
gather_facts: false
pre_tasks:
- import_role:
name: compatibility-checks
- name: Install OpenAppStack
hosts: master
tasks:
- name: Everything for after Kubernetes is installed
block:
- import_role:
name: apps
tags: ['apps']
- import_role:
name: local-flux
tags: ['flux']
when: flux.local_flux
always:
- import_role:
name: finalize
tags: ['finalize']
---
- name: Require minimal ansible version
assert:
that:
- "ansible_version.full is version_compare('2.7', '>=')"
msg: >
"Please use Ansible 2.7 or higher to bootstrap your OAS cluster."
- name: Release name must start with lower case
assert:
that: "'{{ release_name }}' is match('^[a-z]')"
msg: >
"Release name ({{ release_name }}) should start with lower case."
- name: cluster_dir variable is needed
assert:
that: "cluster_dir is defined"
msg: >
"Please define the variable `cluster_dir`."
- name: Check if all variables from settings.yml.example are set in your settings.yml file
assert:
that: "{{ item }} is defined"
msg: >
"Please define the variable `{{ item }}`."
with_items:
- ip_address
- domain
- admin_email
- release_name
- acme_staging
- prometheus_enable_ingress
- backup
- flux
- helm_operator
- enabled_applications
......@@ -412,7 +412,7 @@ To start the installation process, run:
::
$ python -m openappstack my-cluster install
$ python -m openappstack my-cluster install --install-kubernetes
This will take between 5 and 20 minutes. It generates secrets that will
be added to the ``clusters/my-cluster/secrets`` directory. If you ever
......@@ -437,6 +437,11 @@ to settle, and then continue to the next step (validating your setup).
have the ``clusters/my-cluster`` directory and it contains the same
``secrets`` directory before you run the installation command.
.. Note::
The ``--install-kubernetes`` argument installs or updates your VPS's K3s
installation. If you only want to re-run the part that installs OpenAppStack
on your Kubernetes clusters, leave it out.
Step 5: Validate setup
~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -172,7 +172,14 @@ def main(): # pylint: disable=too-many-statements,too-many-branches,too-many-lo
metavar=['PARAM[=VALUE]'],
action='append',
nargs=1,
help='forward ansible parameters to the ansible-playbook call')
help='forward ansible parameters to the ansible-playbook call. If '
'--install-kubernetes is supplied, parameters are passed to both '
'ansible playbooks')
install_parser.add_argument(
'--install-kubernetes',
action='store_true',
help="Installs k3s on your VPS before installing OpenAppStack")
test_parser = subparsers.add_parser(
'test',
......@@ -341,9 +348,16 @@ def install(clus, args):
:param argparse.Namespace args: Command line arguments
"""
clus.load_data()
if args.install_kubernetes:
ansible.run_ansible(
clus,
os.path.join(ansible.ANSIBLE_PATH, 'install-kubernetes.yml'),
args.ansible_param)
ansible.run_ansible(
clus,
os.path.join(ansible.ANSIBLE_PATH, 'bootstrap.yml'),
os.path.join(ansible.ANSIBLE_PATH, 'install-openappstack.yml'),
args.ansible_param)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment