Use consistent, permanent filenames
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
parent
fa8f2d5316
commit
ff117118a5
4 changed files with 25 additions and 31 deletions
|
@ -1,17 +1,10 @@
|
||||||
- name: Create temporary file
|
|
||||||
tempfile: state=file
|
|
||||||
register: tmpfile
|
|
||||||
|
|
||||||
- name: Acquire a keytab
|
- name: Acquire a keytab
|
||||||
include_role:
|
include_role:
|
||||||
name: keytab/service
|
name: keytab/service
|
||||||
vars:
|
vars:
|
||||||
kt_location: "{{ tmpfile.path }}"
|
kt_location: "/etc/openshift_apps/{{app}}/{{key}}.kt"
|
||||||
|
|
||||||
- name: Call `oc secrets new` on the copied file
|
- name: Call `oc secrets new` on the copied file
|
||||||
shell: oc -n {{app}} secrets new {{secret_name}} {{key}}={{tmpfile.path}}
|
shell: oc -n {{app}} secrets new {{secret_name}} {{key}}=/etc/openshift_apps/{{app}}/{{key}}.kt
|
||||||
register: create_out
|
register: create_out
|
||||||
failed_when: "create_out.rc != 0 and 'AlreadyExists' not in create_out.stderr"
|
failed_when: "create_out.rc != 0 and 'AlreadyExists' not in create_out.stderr"
|
||||||
|
|
||||||
#- name: Delete temporary file
|
|
||||||
# file: path={{tmpfile.path}} state=absent
|
|
||||||
|
|
|
@ -1,21 +1,14 @@
|
||||||
- name: Create temporary file
|
|
||||||
tempfile: state=file suffix=.yml
|
|
||||||
register: tmpfile
|
|
||||||
|
|
||||||
- name: Copy template {{template}} to temporary file ({{tmpfile.path}})
|
- name: Copy template {{template}} to temporary file ({{tmpfile.path}})
|
||||||
template: src={{roles_path}}/openshift-apps/{{app}}/templates/{{template}} dest={{tmpfile.path}}
|
template: src={{roles_path}}/openshift-apps/{{app}}/templates/{{template}} dest=/etc/openshift_apps/{{app}}/{{objectname}}
|
||||||
when: template is defined
|
when: template is defined
|
||||||
|
|
||||||
- name: Copy template {{template_fullpath}} to temporary file ({{tmpfile.path}})
|
- name: Copy template {{template_fullpath}} to temporary file ({{tmpfile.path}})
|
||||||
template: src={{template_fullpath}} dest={{tmpfile.path}}
|
template: src={{template_fullpath}} dest=/etc/openshift_apps/{{app}}/{{objectname}}
|
||||||
when: template_fullpath is defined and template is not defined
|
when: template_fullpath is defined and template is not defined
|
||||||
|
|
||||||
- name: Copy file {{file}} to temporary file ({{tmpfile.path}})
|
- name: Copy file {{file}} to temporary file ({{tmpfile.path}})
|
||||||
copy: src={{roles_path}}/openshift-apps/{{app}}/files/{{file}} dest={{tmpfile.path}}
|
copy: src={{roles_path}}/openshift-apps/{{app}}/files/{{file}} dest=/etc/openshift_apps/{{app}}/{{objectname}}
|
||||||
when: file is defined and template is not defined and template_fullpath is not defined
|
when: file is defined and template is not defined and template_fullpath is not defined
|
||||||
|
|
||||||
- name: Call `oc apply` on the copied file
|
- name: Call `oc apply` on the copied file
|
||||||
shell: oc -n {{app}} apply -f {{tmpfile.path}}
|
shell: oc -n {{app}} apply -f /etc/openshift_apps/{{app}}/{{objectname}}
|
||||||
|
|
||||||
- name: Delete temporary file
|
|
||||||
file: path={{tmpfile.path}} state=absent
|
|
||||||
|
|
|
@ -1,4 +1,13 @@
|
||||||
---
|
---
|
||||||
|
- name: Create project directory
|
||||||
|
file:
|
||||||
|
path: /etc/openshift_apps/{{app}}
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0750
|
||||||
|
recurse: yes
|
||||||
|
|
||||||
- name: Determine if project already exists
|
- name: Determine if project already exists
|
||||||
command: oc get project {{app}}
|
command: oc get project {{app}}
|
||||||
register: project_exists
|
register: project_exists
|
||||||
|
@ -10,34 +19,40 @@
|
||||||
include_role:
|
include_role:
|
||||||
name: openshift/object
|
name: openshift/object
|
||||||
vars:
|
vars:
|
||||||
|
objectname: project.yml
|
||||||
template_fullpath: "{{roles_path}}/openshift/project/templates/project.yml"
|
template_fullpath: "{{roles_path}}/openshift/project/templates/project.yml"
|
||||||
|
|
||||||
- name: deployer.yml
|
- name: deployer.yml
|
||||||
include_role:
|
include_role:
|
||||||
name: openshift/object
|
name: openshift/object
|
||||||
vars:
|
vars:
|
||||||
|
objectname: deployer.yml
|
||||||
template_fullpath: "{{roles_path}}/openshift/project/templates/deployer.yml"
|
template_fullpath: "{{roles_path}}/openshift/project/templates/deployer.yml"
|
||||||
|
|
||||||
- name: imagebuilder.yml
|
- name: imagebuilder.yml
|
||||||
include_role:
|
include_role:
|
||||||
name: openshift/object
|
name: openshift/object
|
||||||
vars:
|
vars:
|
||||||
|
objectname: imagebuilder.yml
|
||||||
template_fullpath: "{{roles_path}}/openshift/project/templates/imagebuilder.yml"
|
template_fullpath: "{{roles_path}}/openshift/project/templates/imagebuilder.yml"
|
||||||
|
|
||||||
- name: imagepuller.yml
|
- name: imagepuller.yml
|
||||||
include_role:
|
include_role:
|
||||||
name: openshift/object
|
name: openshift/object
|
||||||
vars:
|
vars:
|
||||||
|
objectname: imagepuller.yml
|
||||||
template_fullpath: "{{roles_path}}/openshift/project/templates/imagepuller.yml"
|
template_fullpath: "{{roles_path}}/openshift/project/templates/imagepuller.yml"
|
||||||
|
|
||||||
- name: role-appowners.yml
|
- name: role-appowners.yml
|
||||||
include_role:
|
include_role:
|
||||||
name: openshift/object
|
name: openshift/object
|
||||||
vars:
|
vars:
|
||||||
|
objectname: role-appowners.yml
|
||||||
template_fullpath: "{{roles_path}}/openshift/project/templates/role-appowners.yml"
|
template_fullpath: "{{roles_path}}/openshift/project/templates/role-appowners.yml"
|
||||||
|
|
||||||
- name: appowners.yml
|
- name: appowners.yml
|
||||||
include_role:
|
include_role:
|
||||||
name: openshift/object
|
name: openshift/object
|
||||||
vars:
|
vars:
|
||||||
|
objectname: appowners.yml
|
||||||
template_fullpath: "{{roles_path}}/openshift/project/templates/appowners.yml"
|
template_fullpath: "{{roles_path}}/openshift/project/templates/appowners.yml"
|
||||||
|
|
|
@ -1,23 +1,16 @@
|
||||||
- name: Create temporary file
|
|
||||||
tempfile: state=file
|
|
||||||
register: tmpfile
|
|
||||||
|
|
||||||
- name: Copy template {{template}} to temporary file ({{tmpfile.path}})
|
- name: Copy template {{template}} to temporary file ({{tmpfile.path}})
|
||||||
template: src={{roles_path}}/openshift-apps/{{app}}/templates/{{template}} dest={{tmpfile.path}}
|
template: src={{roles_path}}/openshift-apps/{{app}}/templates/{{template}} /etc/openshift_apps/{{app}}/{{key}}
|
||||||
when: template is defined
|
when: template is defined
|
||||||
|
|
||||||
- name: Copy file {{file}} to temporary file ({{tmpfile.path}})
|
- name: Copy file {{file}} to temporary file ({{tmpfile.path}})
|
||||||
copy: src={{roles_path}}/openshift-apps/{{app}}/files/{{file}} dest={{tmpfile.path}}
|
copy: src={{roles_path}}/openshift-apps/{{app}}/files/{{file}} dest=/etc/openshift_apps/{{app}}/{{key}}
|
||||||
when: file is defined
|
when: file is defined
|
||||||
|
|
||||||
- name: Copy private file {{privatefile}} to temporary file ({{tmpfile.path}})
|
- name: Copy private file {{privatefile}} to temporary file ({{tmpfile.path}})
|
||||||
copy: src={{private}}/files/{{privatefile}} dest={{tmpfile.path}}
|
copy: src={{private}}/files/{{privatefile}} /etc/openshift_apps/{{app}}/{{key}}
|
||||||
when: privatefile is defined
|
when: privatefile is defined
|
||||||
|
|
||||||
- name: Call `oc secrets new` on the copied file
|
- name: Call `oc secrets new` on the copied file
|
||||||
shell: oc -n {{app}} secrets new {{secret_name}} {{key}}={{tmpfile.path}}
|
shell: oc -n {{app}} secrets new {{secret_name}} {{key}}=/etc/openshift_apps/{{app}}/{{key}}
|
||||||
register: create_out
|
register: create_out
|
||||||
failed_when: "create_out.rc != 0 and 'AlreadyExists' not in create_out.stderr"
|
failed_when: "create_out.rc != 0 and 'AlreadyExists' not in create_out.stderr"
|
||||||
|
|
||||||
- name: Delete temporary file
|
|
||||||
file: path={{tmpfile.path}} state=absent
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue