Skip to content

Commit

Permalink
Update to allow execution of system checks in check and diff modes (#166
Browse files Browse the repository at this point in the history
)

* 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 <clevesque@cloudera.com>
  • Loading branch information
clevesque authored Mar 21, 2024
1 parent 9064af6 commit 6ef8492
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions roles/deployment/credential/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
no_log: true
vars:
__licname: "{{ cloudera_manager_license | regex_replace('(.|\n)*\"name\"\\s*:\\s*\"([^\"]*)\"(.|\n)*', '\\2') }}"
check_mode: false

- name: Set password from processed Cloudera License Content
no_log: true
Expand Down
2 changes: 2 additions & 0 deletions roles/prereqs/jdk/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@
- name: Capture installed Java provider
shell: /usr/bin/java -version 2>&1 | egrep -o 'Java\(TM\)|OpenJDK' | sed 's/Java(TM)/Oracle/' | tr '[A-Z]' '[a-z]' | head -1
register: provider
check_mode: false

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

- set_fact:
installed_jdk_provider: "{{ provider.stdout_lines[0] }}"
Expand Down
1 change: 1 addition & 0 deletions roles/prereqs/license/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- cloudera_manager_license_file
- "'cloudera_manager' in groups"
- inventory_hostname in groups['cloudera_manager']
check_mode: false

- name: Set license type to Enterprise if license is presented
ansible.builtin.set_fact:
Expand Down
4 changes: 4 additions & 0 deletions roles/prereqs/mysql_connector/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,23 @@
lock_timeout: "{{ (ansible_os_family == 'RedHat') | ternary(60, omit) }}"
name: unzip
state: present
ignore_errors: "{{ ansible_check_mode }}"

- name: Extract MySQL Connector/J zip file
unarchive:
src: "{{ mysql_connector_download_dir }}/mysql-connector-java.zip"
dest: "{{ mysql_connector_extract_dir }}"
exclude:
- src
ignore_errors: "{{ ansible_check_mode }}"

- name: Copy MySQL Connector/J jar file to correct location
copy:
src: "{{ mysql_connector_local_path }}"
dest: /usr/share/java/mysql-connector-java.jar
remote_src: yes
mode: 0644
ignore_errors: "{{ ansible_check_mode }}"

# MySql on rhel8 fix
- name: Fix MySQL on RHEL8
Expand All @@ -70,6 +73,7 @@
template:
src: my_config.h
dest: /usr/include/mysql/my_config.h
ignore_errors: "{{ ansible_check_mode }}"

## TODO Fix for RHEL8
- name: Install Mysql packages for python - PyMySQL
Expand Down
3 changes: 2 additions & 1 deletion roles/prereqs/postgresql_connector/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
src: "{{ local_temp_dir }}/postgresql-connector-java.jar"
dest: /usr/share/java/postgresql-connector-java.jar
mode: 0644
ignore_errors: "{{ ansible_check_mode }}"

# SSB will need the python3-psycopg2 connector

Expand All @@ -47,4 +48,4 @@

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

0 comments on commit 6ef8492

Please sign in to comment.