--- # Copyright 2018, Rackspace US, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - name: Check for go stat: path: /opt/go1.10.1/go/bin/go register: go_path - name: Install go block: - name: GET go get_url: url: "https://dl.google.com/go/go1.10.1.linux-amd64.tar.gz" dest: "/opt/go1.10.1.linux-amd64.tar.gz" checksum: "sha256:72d820dec546752e5a8303b33b009079c15c2390ce76d67cf514991646c6127b" register: _get_task until: _get_task is success retries: 3 delay: 2 tags: - package_install - name: Create go directory file: path: "/opt/go1.10.1" state: directory - name: Unarchive go unarchive: src: "/opt/go1.10.1.linux-amd64.tar.gz" dest: "/opt/go1.10.1" remote_src: yes - name: Create go defaults file copy: content: | GOROOT=/opt/go1.10.1/go GOPATH=/usr/local PATH=${PATH}:${GOROOT}/bin dest: /etc/default/go1.10.1 when: - (elk_package_state | default('present')) == 'present' - not go_path.stat.exists | bool - name: Remove go file: path: "/opt/go1.10.1" state: absent when: - (elk_package_state | default('present')) == 'absent'