Englobe tasks with same when statement in block
This commit is contained in:
parent
376628a914
commit
5fd5ddc61f
@ -7,24 +7,24 @@
|
|||||||
- tar
|
- tar
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: Check if NodeJS service Exists
|
- name: Check if NodeJS service exists
|
||||||
stat:
|
stat:
|
||||||
path: /usr/bin/node
|
path: /usr/bin/node
|
||||||
register: node_service_status
|
register: node_service_status
|
||||||
|
|
||||||
- name: Installing NodeJS repository script
|
- name: Install NodeJS repository
|
||||||
become: true
|
block:
|
||||||
get_url:
|
- name: Download NodeJS repository script
|
||||||
url: "https://{{ repo_dic[ansible_os_family|lower] }}.nodesource.com/setup_8.x"
|
get_url:
|
||||||
dest: /etc/nodejs.sh
|
url: "https://{{ repo_dic[ansible_os_family|lower] }}.nodesource.com/setup_8.x"
|
||||||
mode: '0775'
|
dest: /etc/nodejs.sh
|
||||||
changed_when: false
|
mode: '0775'
|
||||||
when: not node_service_status.stat.exists
|
changed_when: false
|
||||||
|
|
||||||
- name: Running NodeJS bash script
|
- name: Run NodeJS bash script
|
||||||
command: sh /etc/nodejs.sh
|
command: sh /etc/nodejs.sh
|
||||||
register: nodejs_script
|
register: nodejs_script
|
||||||
changed_when: nodejs_script.rc == 0
|
changed_when: nodejs_script.rc == 0
|
||||||
when: not node_service_status.stat.exists
|
when: not node_service_status.stat.exists
|
||||||
|
|
||||||
- name: Installing NodeJS
|
- name: Installing NodeJS
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user