Skip to content

Commit 3eeca04

Browse files
committed
service initialization conditions updated
1 parent 25a70a6 commit 3eeca04

File tree

8 files changed

+13
-5
lines changed

8 files changed

+13
-5
lines changed

roles/common/templates/services.xml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
<service id="postgresql" host="{{ item }}"
108108
start="service postgresql start &gt; /dev/null 2&gt; /dev/null"
109109
stop="service postgresql stop &gt; /dev/null 2&gt; /dev/nul"
110-
status="service postgresql status &gt; /dev/null">
110+
status="service postgresql status &gt; /dev/null 2&gt; /dev/nul">
111111
</service>
112112
{% endfor %}
113113

roles/hadoop/tasks/namenode.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
- name: init secondary instance
4545
command: sudo -Hu hdfs hdfs namenode -bootstrapStandby
46-
when: ansible_hostname != groups['namenodes'][0]
46+
when: ansible_hostname != groups['namenodes'][0] and destroy_data
4747

4848
- name: start secondary namenode
4949
tags: service

roles/hadoop/tasks/resourcemanager.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
- name: configure hdfs directories
2222
command: sudo -Hu hdfs hdfs dfs {{ item }}
2323
with_items:
24-
- -mkdir /tmp
24+
- -mkdir -p /tmp
2525
- -chmod 1777 /tmp
2626
- -mkdir -p /user/history
2727
- -chmod 1777 /user/history

roles/hivemetastore/tasks/main.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
- name: create metastore database
4747
command: psql -h {{ groups['postgresql'][0] }} --username postgres -f /tmp/ahive.sql chdir=/usr/lib/hive/scripts/metastore/upgrade/postgres
48+
when: destroy_data
4849

4950
- name: remove sql and .pgpass files
5051
command: rm -f /tmp/ahive.sql /root/.pgpass

roles/hue/tasks/main.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848

4949
- name: create database
5050
command: psql -h {{ groups['postgresql'][0] }} --username postgres -f /tmp/hue.sql
51+
when: destroy_data
52+
run_once: true
5153

5254
- name: remove sql and .pgpass files
5355
command: rm -f /tmp/hue.sql /root/.pgpass
@@ -59,6 +61,8 @@
5961
- /usr/lib/hue/build/env/bin/hue syncdb --noinput
6062
- /usr/lib/hue/build/env/bin/hue migrate
6163
- rm -rf logs
64+
when: destroy_data
65+
run_once: true
6266

6367
- name: start services
6468
tags: service

roles/oozie/tasks/main.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@
8484

8585
- name: initialize database
8686
command: service oozie init
87+
when: destroy_data
88+
run_once: true
8789

8890
- name: start services
8991
tags: service

roles/postgresql/tasks/main.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424

2525
- name: set postgres password
2626
command: sudo -Hu postgres psql -c "alter user postgres with password '{{ postgres_password }}';"
27+
when: destroy_data
2728

2829
- name: install userdb sql
2930
template: src=userdb.sql.j2 dest=/tmp/userdb.sql
3031
when: user_database is defined
3132

3233
- name: create userdb
3334
command: sudo -Hu postgres psql -f /tmp/userdb.sql
34-
when: user_database is defined
35+
when: user_database is defined and destroy_data
3536

3637
- name: remove userdb sql
3738
command: rm -f /tmp/userdb.sql

roles/solr/tasks/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
- name: create hdfs directories
3434
command: sudo -Hu hdfs hdfs dfs {{ item }}
3535
with_items:
36-
- -mkdir /solr
36+
- -mkdir -p /solr
3737
- -chown solr /solr
3838
run_once: true
3939

0 commit comments

Comments
 (0)