-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: adding k8s module #171
Open
joejstuart
wants to merge
6
commits into
CentOS-PaaS-SIG:master
Choose a base branch
from
joejstuart:k8s_update
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
86d1256
adding k8s deployment method
joejstuart 343f4ea
adding new auth
joejstuart b2ebc2b
fixing readme
joejstuart 4c2c91e
removing unneeded files
joejstuart d4321a1
adding set_containers|bool == true
joejstuart ef0307e
make minishift and k8s_objects external
joejstuart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
- name: set minishift host | ||
block: | ||
- name: register minishift host | ||
shell: "{{ minishift_bin }} ip" | ||
register: minishift_host | ||
|
||
- name: set k8s_auth_host | ||
set_fact: | ||
k8s_auth_host: "https://{{ minishift_host.stdout }}:8443" | ||
when: k8s_auth_host is not defined | ||
|
||
- name: set auth api key if env var is set | ||
set_fact: | ||
k8s_auth_api_key: "{{ ansible_env.K8S_AUTH_API_KEY }}" | ||
when: ansible_env.K8S_AUTH_API_KEY is defined | ||
|
||
- name: Log in (obtain access token) | ||
k8s_auth: | ||
host: "{{ k8s_auth_host }}" | ||
validate_certs: False | ||
username: "{{ k8s_username }}" | ||
password: "{{ k8s_password }}" | ||
register: k8s_auth_results | ||
when: k8s_username is defined and k8s_password is defined | ||
|
||
- name: set auth api key if username/password is provided | ||
set_fact: | ||
k8s_auth_api_key: "{{ k8s_auth_results.k8s_auth.api_key }}" | ||
when: k8s_auth_results.k8s_auth.api_key is defined | ||
|
||
- name: Create openshift project | ||
k8s: | ||
host: "{{ k8s_auth_host }}" | ||
api_key: "{{ k8s_auth_api_key }}" | ||
name: "{{ PROJECT }}" | ||
api_version: v1 | ||
kind: Project | ||
state: present | ||
validate_certs: false | ||
|
||
- name: Creating k8s objects | ||
k8s: | ||
host: "{{ k8s_auth_host }}" | ||
api_key: "{{ k8s_auth_api_key }}" | ||
namespace: "{{ PROJECT }}" | ||
state: present | ||
validate_certs: false | ||
definition: "{{ lookup('template', project_dir + '/' + os_template_dir + '/' + item) }}" | ||
with_list: | ||
"{{ k8s_resource_objects }}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this list come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now it's being passed in as an --extra-var. I still need to add a vars file for this role and go through the global vars to sync it up with these changes.