--- - block: - name: Install the Node.js repository package package: name={{ node_js_el_repo_pkg }} state=present - name: Install the Node.js packages package: name={{ node_js_pkgs }} state={{ node_js_pkg_state }} tags: [ 'nodejs', 'node_js' ] - block: - name: Install the Node.js yarn repository configuration get_url: url={{ node_js_yarn_el_repo_url }} dest=/etc/yum.repos.d/yarn.repo - name: Install the Node.js yarn packages package: name={{ node_js_yarn_pkgs }} state={{ node_js_pkg_state }} when: node_js_yarn_install tags: [ 'nodejs', 'node_js', 'yarn', 'node_js_yarn' ] - block: - name: Remove the Node.js yarn packages package: name={{ node_js_yarn_pkgs }} state=absent - name: Remove the Node.js yarn repository configuration file: dest=/etc/yum.repos.d/yarn.repo state=absent when: not node_js_yarn_install tags: [ 'nodejs', 'node_js', 'yarn', 'node_js_yarn' ]