Skip to content

Instantly share code, notes, and snippets.

@mattpwest
Created May 17, 2018 10:22
Show Gist options
  • Save mattpwest/33856d0fd23ef2641b738c13fa4cd6a7 to your computer and use it in GitHub Desktop.
Save mattpwest/33856d0fd23ef2641b738c13fa4cd6a7 to your computer and use it in GitHub Desktop.
Sonarqube Ansible Play: Part 2 - PostgreSQL
# - name: Create postgres user for SonarQube
# become: yes
# become_user: postgres
# postgresql_user:
# name: "{{ sonar_db_user }}"
# password: 'str[\"md5\"] + md5[ {{ sonar_db_pass }} + {{ sonar_db_user }} ]'
# encrypted: yes
#
# - name: Create the sonar database
# postgresql_db:
# name: "{{ sonar_db_name }}"
# owner: "{{ sonar_db_user }}"
- name: Copy the SonarQube PostgreSQL setup script
copy:
src: "../files/sonar/dbSetup.sh"
dest: "/tmp/dbSetup.sh"
mode: 0744
owner: "postgres"
- name: Strip carriage returns from scripts to ensure this works from Windows VMs
replace:
path: "/tmp/dbSetup.sh"
regexp: "[\r]$"
replace: ""
- name: Create postgres user and DB for SonarQube
become: yes
become_user: postgres
command: "/tmp/dbSetup.sh {{ sonar_db_pass }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment