Skip to content

Commit 99edef5

Browse files
committed
Improve deploy-crc-cloud role
What changed: - improve condition that is veryfing if cluster is healthy - move htpasswd container image to be created task before to avoid multiple time rebuilding same image - add "no_log" to avoid display users passwords Signed-off-by: Daniel Pawlik <[email protected]>
1 parent d86f297 commit 99edef5

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed
Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,4 @@
11
---
2-
- name: Create temporary directory
3-
ansible.builtin.tempfile:
4-
state: directory
5-
register: _temp_dir
6-
7-
- name: Create Dockerfile
8-
ansible.builtin.copy:
9-
content: |
10-
FROM quay.io/centos/centos:stream9-minimal
11-
RUN microdnf --setopt=tsflags=nodocs --setopt=install_weak_deps=0 install -y httpd-tools
12-
ENTRYPOINT ["htpasswd", "-Bbn"]
13-
dest: "{{ _temp_dir.path }}/Dockerfile"
14-
15-
- name: Build container image for htpasswd
16-
ansible.builtin.command: |
17-
podman build -t localhost/htpasswd:latest -f {{ _temp_dir.path }}/Dockerfile
18-
192
- name: "Get htpasswd for {{ user.name }}"
203
ansible.builtin.shell: |
214
podman run --rm -ti localhost/htpasswd:latest {{ user.name }} {{ user.password }} >> htpasswd.txt
22-
23-
- name: Remove temporary directory
24-
ansible.builtin.file:
25-
path: "{{ _temp_dir.path }}"
26-
state: absent

ansible/roles/deploy-crc-cloud/tasks/set_credentials.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,29 @@
55
path: htpasswd.txt
66
state: absent
77

8+
- name: Create temporary directory
9+
ansible.builtin.tempfile:
10+
state: directory
11+
register: _temp_dir
12+
13+
- name: Create Dockerfile
14+
ansible.builtin.copy:
15+
content: |
16+
FROM quay.io/centos/centos:stream9-minimal
17+
RUN microdnf --setopt=tsflags=nodocs --setopt=install_weak_deps=0 install -y httpd-tools
18+
ENTRYPOINT ["htpasswd", "-Bbn"]
19+
dest: "{{ _temp_dir.path }}/Dockerfile"
20+
21+
- name: Build container image for htpasswd
22+
ansible.builtin.command: |
23+
podman build -t localhost/htpasswd:latest -f {{ _temp_dir.path }}/Dockerfile
24+
825
- name: Get htpasswd
926
ansible.builtin.include_tasks: get_htpasswd.yaml
1027
loop: "{{ users }}"
1128
loop_control:
1229
loop_var: user
30+
no_log: true
1331

1432
- name: Cleanup htpasswd.txt file
1533
ansible.builtin.shell: |
@@ -25,3 +43,8 @@
2543
2644
- name: Replace htpass-secret
2745
ansible.builtin.command: oc replace -f /tmp/htpass-secret.yaml
46+
47+
- name: Remove temporary directory
48+
ansible.builtin.file:
49+
path: "{{ _temp_dir.path }}"
50+
state: absent

ansible/roles/deploy-crc-cloud/tasks/wait_cluster_become_healthy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
retries: "{{ max_retries }}"
1010
delay: "{{ retry_delay }}"
1111
until: "'False' not in component_status.stdout_lines"
12-
failed_when: "'False' in component_status.stdout_lines and retry_count >= max_retries"
12+
failed_when: "'False' in component_status.stdout_lines"
1313
ignore_errors: true
1414

1515
- name: Output success message if components are healthy

0 commit comments

Comments
 (0)