Skip to content

Commit 6ef8492

Browse files
authored
Update to allow execution of system checks in check and diff modes (#166)
* Enables check and diff mode on plays * Allows "Capture installed Java provider" & "Capture installed Java version" tasks to run during check/diff mode, so that facts are populated successfully later * Allows Postgres and MySQL Connectors to run during check/diff mode Signed-off-by: Chuck Levesque <[email protected]>
1 parent 9064af6 commit 6ef8492

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

roles/deployment/credential/tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
no_log: true
3333
vars:
3434
__licname: "{{ cloudera_manager_license | regex_replace('(.|\n)*\"name\"\\s*:\\s*\"([^\"]*)\"(.|\n)*', '\\2') }}"
35+
check_mode: false
3536

3637
- name: Set password from processed Cloudera License Content
3738
no_log: true

roles/prereqs/jdk/tasks/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@
5656
- name: Capture installed Java provider
5757
shell: /usr/bin/java -version 2>&1 | egrep -o 'Java\(TM\)|OpenJDK' | sed 's/Java(TM)/Oracle/' | tr '[A-Z]' '[a-z]' | head -1
5858
register: provider
59+
check_mode: false
5960

6061
- name: Capture installed Java version
6162
shell: /usr/bin/java -version 2>&1 | grep version | tr -d '"' | tr "_" " " | awk '{print $3"\n"$4}'
6263
register: version
64+
check_mode: false
6365

6466
- set_fact:
6567
installed_jdk_provider: "{{ provider.stdout_lines[0] }}"

roles/prereqs/license/tasks/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- cloudera_manager_license_file
2323
- "'cloudera_manager' in groups"
2424
- inventory_hostname in groups['cloudera_manager']
25+
check_mode: false
2526

2627
- name: Set license type to Enterprise if license is presented
2728
ansible.builtin.set_fact:

roles/prereqs/mysql_connector/tasks/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,23 @@
3535
lock_timeout: "{{ (ansible_os_family == 'RedHat') | ternary(60, omit) }}"
3636
name: unzip
3737
state: present
38+
ignore_errors: "{{ ansible_check_mode }}"
3839

3940
- name: Extract MySQL Connector/J zip file
4041
unarchive:
4142
src: "{{ mysql_connector_download_dir }}/mysql-connector-java.zip"
4243
dest: "{{ mysql_connector_extract_dir }}"
4344
exclude:
4445
- src
46+
ignore_errors: "{{ ansible_check_mode }}"
4547

4648
- name: Copy MySQL Connector/J jar file to correct location
4749
copy:
4850
src: "{{ mysql_connector_local_path }}"
4951
dest: /usr/share/java/mysql-connector-java.jar
5052
remote_src: yes
5153
mode: 0644
54+
ignore_errors: "{{ ansible_check_mode }}"
5255

5356
# MySql on rhel8 fix
5457
- name: Fix MySQL on RHEL8
@@ -70,6 +73,7 @@
7073
template:
7174
src: my_config.h
7275
dest: /usr/include/mysql/my_config.h
76+
ignore_errors: "{{ ansible_check_mode }}"
7377

7478
## TODO Fix for RHEL8
7579
- name: Install Mysql packages for python - PyMySQL

roles/prereqs/postgresql_connector/tasks/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
src: "{{ local_temp_dir }}/postgresql-connector-java.jar"
3636
dest: /usr/share/java/postgresql-connector-java.jar
3737
mode: 0644
38+
ignore_errors: "{{ ansible_check_mode }}"
3839

3940
# SSB will need the python3-psycopg2 connector
4041

@@ -47,4 +48,4 @@
4748

4849
- name: Install python3-psycopg2
4950
shell: "pip3 install psycopg2-binary==2.8.5 -t /usr/share/python3"
50-
when: install_py3_psycopg2 == true
51+
when: install_py3_psycopg2 == true

0 commit comments

Comments
 (0)