-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #176 from idealista/hotfix/175
#175 add error handling on deploy playbook
- Loading branch information
Showing
6 changed files
with
65 additions
and
36 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
--- | ||
|
||
- name: Get JAVA_HOME variable | ||
community.docker.docker_container_exec: | ||
container: "{{ 'jdk' + '-' + item }}" | ||
command: grep -i -o 'JAVA_HOME.*' /etc/profile.d/jdk.sh | ||
register: java_home | ||
- name: Commit environment variables into containers | ||
block: | ||
- name: Get JAVA_HOME variable | ||
community.docker.docker_container_exec: | ||
container: "{{ 'jdk' + '-' + item }}" | ||
command: grep -i -o 'JAVA_HOME.*' /etc/profile.d/jdk.sh | ||
register: java_home | ||
|
||
- set_fact: java_home="{{ java_home.stdout }}" | ||
- set_fact: java_home="{{ java_home.stdout }}" | ||
|
||
- name: Commit container JAVA_HOME variable to image | ||
command: docker commit --change "ENV {{ java_home }}" {{ 'jdk' + '-' + item }} idealista/jdk:{{ docker_tag + '-' + item}} | ||
- name: Commit container JAVA_HOME variable to image | ||
command: docker commit --change "ENV {{ java_home }}" {{ 'jdk' + '-' + item }} idealista/jdk:{{ docker_tag + '-' + item}} | ||
|
||
- name: Log into Docker Hub | ||
docker_login: | ||
email: "{{ docker_hub_email }}" | ||
username: "{{ docker_hub_username }}" | ||
password: "{{ docker_hub_password }}" | ||
- name: Log into Docker Hub | ||
docker_login: | ||
email: "{{ docker_hub_email }}" | ||
username: "{{ docker_hub_username }}" | ||
password: "{{ docker_hub_password }}" | ||
|
||
- name: Tag and push to Docker Hub | ||
command: docker push idealista/jdk:{{ docker_tag + '-' + item }} | ||
- name: Tag and push to Docker Hub | ||
command: docker push idealista/jdk:{{ docker_tag + '-' + item }} | ||
|
||
- name: Remove the container | ||
docker_container: | ||
name: "{{ 'jdk' + '-' + item }}" | ||
state: absent | ||
- name: Remove the container | ||
docker_container: | ||
name: "{{ 'jdk' + '-' + item }}" | ||
state: absent | ||
|
||
when: "failed_architectures is not defined or failed_architectures | join('|') | regex_search(item) != item" |
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,12 @@ | ||
--- | ||
|
||
- name: Execute role | ||
block: | ||
- include_role: | ||
name: java_role | ||
rescue: | ||
- set_fact: | ||
failed_execution: True | ||
- debug: | ||
msg: "The container {{ ansible_nodename }} couldn't execute roles correctly." | ||
|
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 @@ | ||
dockerhub_image_architectures: ['amd64', 'arm64'] |
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