Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions roles/nginx/tasks/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,18 @@

- name: Creating namespace material
k8s:
definition: "{{ lookup('template', '{{ item }}.yaml.j2') }}"
definition: "{{ lookup('template', item) }}"
wait: yes
loop:
- serviceaccount
- role

- name: Relax {{ nx_namespace }} 'default' service account (for cert-manager)
k8s:
definition: "{{ lookup('template', 'rolebinding-default-sa.yaml.j2') }}"
wait: yes
- serviceaccount.yaml.j2

- name: Deploy nginx ({{ nx_hostname }})
k8s:
definition: "{{ lookup('template', '{{ item }}.yaml.j2') }}"
definition: "{{ lookup('template', item) }}"
wait: yes
wait_timeout: "{{ wait_timeout }}"
loop:
- configmap
- deployment
- service
- ingress
- configmap.yaml.j2
- deployment.yaml.j2
- service.yaml.j2
- ingress.yaml.j2
17 changes: 0 additions & 17 deletions roles/nginx/tasks/login.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions roles/nginx/tasks/logout.yaml

This file was deleted.

19 changes: 4 additions & 15 deletions roles/nginx/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

- include_tasks: prep.yaml

# If it looks like we're deploying to OpenShift
# we need to use the k8s authentication module to login
# and obtain an API key.
- include_tasks: login.yaml
when: okd_master_hostname is defined

# A kubernetes (or OpenShift) host and an API key must be set.
# We will either have authenticated against an OpenShift server
# or the AWX kubernetes credentials will have injected suitable
Expand All @@ -17,24 +11,19 @@
- name: Assert authentication
assert:
that:
- k8s_auth_host|length > 0
- k8s_auth_api_key|length > 0
- k8s_auth_host | length > 0
- k8s_auth_api_key | length > 0

# Go...

- block:

- include_tasks: deploy.yaml
when: nx_state|string == 'present'
when: nx_state | string == 'present'
- include_tasks: undeploy.yaml
when: nx_state|string == 'absent'
when: nx_state | string == 'absent'

module_defaults:
group/k8s:
host: "{{ k8s_auth_host }}"
api_key: "{{ k8s_auth_api_key }}"

# If it looks like we're deploying to OpenShift
# we now need to logout...
- include_tasks: logout.yaml
when: okd_master_hostname is defined
9 changes: 0 additions & 9 deletions roles/nginx/tasks/prep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@
- debug:
var: ansible_version.full

# Basic pre-playbook prerequisites.
# We need the openshift/kubernetes module amongst other things...

- name: Install prerequisite Python modules
pip:
name:
- jmespath==0.9.4
extra_args: --user

# Kubernetes credentials ------------------------------------------------------

# We don't use the Kubernetes credentials directly,
Expand Down
11 changes: 0 additions & 11 deletions roles/nginx/templates/role.yaml.j2

This file was deleted.

18 changes: 0 additions & 18 deletions roles/nginx/templates/rolebinding-default-sa.yaml.j2

This file was deleted.