Skip to content

Commit

Permalink
Merge pull request #204 from HewlettPackard/ext_repo_https
Browse files Browse the repository at this point in the history
Update to ext repo role for https web server
  • Loading branch information
alisha-k-kalladassery authored Jul 18, 2022
2 parents 645dafc + a33b91a commit c261e4c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
3 changes: 1 addition & 2 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
"repository_username": "<repository_username>",
"repository_password": "<repository_password>",
"repository_uri": "<repository_uri>",
"remote_server": "<remote_server>",
"certificate": "<certificate>"
"remote_server": "<remote_server>"
}
}
38 changes: 24 additions & 14 deletions roles/oneview_repositories/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,26 @@

- debug: var=session

- name: Gather facts about a Server Certificate by remote address
oneview_certificates_server_facts:
config: "{{ config }}"
sessionID: "{{ session.ansible_facts.session }}"
remote: "{{ contents.repositories.remote_server }}"
delegate_to: localhost

- set_fact:
certificate: "{{ remote_certificate['certificateDetails'][0]['base64Data'] }}"

#Server Certificate need to be added to appliance for using an Https web server
- name: Create a Server Certificate
oneview_certificates_server:
config: "{{ config }}"
sessionID: "{{ session.ansible_facts.session }}"
state: present
name: "{{ remote_server }}"
name: "{{ contents.repositories.remote_server }}"
data:
certificateDetails:
- aliasName: "{{ remote_server }}"
- aliasName: "{{ contents.repositories.remote_server }}"
base64Data: "{{ certificate }}"
delegate_to: localhost

Expand All @@ -28,10 +38,10 @@
state: present
validate_etag: False
data:
name: "{{ repository_name }}"
userName: "{{ repository_username }}"
password: "{{ repository_password }}"
repositoryURI: "{{ repository_uri }}"
name: "{{ contents.repositories.repository_name }}"
userName: "{{ contents.repositories.repository_username }}"
password: "{{ contents.repositories.repository_password }}"
repositoryURI: "{{ contents.repositories.repository_uri }}"
repositoryType: "FirmwareExternalRepo"
delegate_to: localhost
register: repository
Expand All @@ -42,10 +52,10 @@
sessionID: "{{ session.ansible_facts.session }}"
state: present
data:
name: "{{ repository_name }}"
userName: "{{ repository_username }}"
password: "{{ repository_password }}"
repositoryURI: "{{ repository_uri }}"
name: "{{ contents.repositories.repository_name }}"
userName: "{{ contents.repositories.repository_username }}"
password: "{{ contents.repositories.repository_password }}"
repositoryURI: "{{ contents.repositories.repository_uri }}"
repositoryType: "FirmwareExternalRepo"
delegate_to: localhost

Expand All @@ -55,8 +65,8 @@
sessionID: "{{ session.ansible_facts.session }}"
state: patch
data:
name: "{{ repository_name }}"
newName: "{{ repository_name }}-updated"
name: "{{ contents.repositories.repository_name }}"
newName: "{{ contents.repositories.repository_name }}-updated"
delegate_to: localhost

- name: Delete the Repository
Expand All @@ -65,7 +75,7 @@
sessionID: "{{ session.ansible_facts.session }}"
state: absent
data:
name: "{{ repository_name }}"
name: "{{ contents.repositories.repository_name }}"
params:
force: True
delegate_to: localhost
Expand All @@ -77,6 +87,6 @@
sessionID: "{{ session.ansible_facts.session }}"
state: absent
data:
name: "{{ repository_name }}"
name: "{{ contents.repositories.repository_name }}"
delegate_to: localhost
register: deleted

0 comments on commit c261e4c

Please sign in to comment.