From a450344342e81d190fe7c371c793b2b6d633648b Mon Sep 17 00:00:00 2001 From: Alan Christie Date: Mon, 3 Jul 2023 16:01:08 +0100 Subject: [PATCH] Adds prompt and updated k8s --- doc/getting-started.rst | 22 +++++++++++----------- requirements.txt | 2 +- roles/infrastructure/tasks/deploy.yaml | 12 ++++++++++++ 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/doc/getting-started.rst b/doc/getting-started.rst index 01e6ba3..90ff670 100644 --- a/doc/getting-started.rst +++ b/doc/getting-started.rst @@ -18,14 +18,14 @@ Working environment Ideally you'll start from a Python 3.8 virtual environment:: - $ python -m venv ~/.venv/ansible-infrastructure - $ source ~/.venv/ansible-infrastructure/bin/activate - $ pip install --upgrade pip + python -m venv ~/.venv/ansible-infrastructure + source ~/.venv/ansible-infrastructure/bin/activate + pip install --upgrade pip ...and then install the required modules, roles and collections:: - $ pip install -r requirements.txt - $ ansible-galaxy install -r role-requirements.yaml --force-with-deps + pip install -r requirements.txt + ansible-galaxy install -r role-requirements.yaml --force-with-deps Cluster (Kubernetes) pre-requisites =================================== @@ -78,10 +78,10 @@ we need to provide values for these. The ``HOST`` is the **clusters -> cluster -> server** value from the config file and the ``API_KEY`` is the **users -> user -> token** value:: - $ export K8S_AUTH_HOST=https://1.2.3.4:6443 - $ export K8S_AUTH_API_KEY=kubeconfig-user-abc:00000000 - $ export K8S_AUTH_VERIFY_SSL=no - $ export K8S_CONTEXT=im-eks-admin + export K8S_AUTH_HOST=https://1.2.3.4:6443 + export K8S_AUTH_API_KEY=kubeconfig-user-abc:00000000 + export K8S_AUTH_VERIFY_SSL=no + export K8S_CONTEXT=im-eks-admin To confirm you have the right context you should run the following command to list the valid contexts:: @@ -91,8 +91,8 @@ command to list the valid contexts:: You will also need to provide standard AWS credentials for the cluster you're configuring via the environment for some of the Roles to properly function:: - $ export AWS_ACCESS_KEY_ID=xxxxxxxxxxxx - $ export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxx + export AWS_ACCESS_KEY_ID=xxxxxxxxxxxx + export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxx The permissions of the AWS user will depend on what you intend to deploy. diff --git a/requirements.txt b/requirements.txt index fbb49df..b0e2dfe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ ansible == 2.9.27 -kubernetes == 19.15.0 +kubernetes == 20.13.0 openshift == 0.13.1 ansible-tower-cli == 3.3.9 diff --git a/roles/infrastructure/tasks/deploy.yaml b/roles/infrastructure/tasks/deploy.yaml index 458656b..2bb7ab9 100644 --- a/roles/infrastructure/tasks/deploy.yaml +++ b/roles/infrastructure/tasks/deploy.yaml @@ -16,6 +16,18 @@ # Namespace and basic material ------------------------------------------------ +- name: A cautionary reminder before we continue + ansible.builtin.pause: + prompt: > + Are you sure you want to configure the infrastructure namespace "{{ infra_namespace }}"? + Type 'YES' to continue + register: pause_result + +- name: Assert confirmation + ansible.builtin.assert: + that: pause_result.user_input == 'YES' + fail_msg: "Stopping - you did not type YES" + - name: Create namespace k8s: definition: "{{ lookup('template', 'namespace-im-infra.yaml.j2') }}"