Skip to content

Commit

Permalink
Adds prompt and updated k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Christie committed Jul 3, 2023
1 parent 26db818 commit a450344
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
22 changes: 11 additions & 11 deletions doc/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
===================================
Expand Down Expand Up @@ -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::
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 12 additions & 0 deletions roles/infrastructure/tasks/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}"
Expand Down

0 comments on commit a450344

Please sign in to comment.