WSLへのHalyardインストール

# 概要
Ubuntu 18.04 LTS でもインストールはできるよ。


# 環境
Windows10 Pro
バージョン 1803
WSL ... Ubuntu 18.04 LTS

# インストール
[公式通り](https://www.spinnaker.io/setup/install/halyard/#install-on-debianubuntu-and-macos)

```bash
$ curl -O https://raw.githubusercontent.com/spinnaker/halyard/master/install/debian/InstallHalyard.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10635  100 10635    0     0  30127      0 --:--:-- --:--:-- --:--:-- 30213


$ sudo bash InstallHalyard.sh
[sudo] password for unix_user:
Please supply a non-root user to run Halyard as: unix_user # 対話式で入力
Halyard version will be stable
Halyard will be downloaded from gs://spinnaker-artifacts/halyard
Halyard config will come from bucket gs://halconfig
Halconfig will be stored at /home/unix_user/.hal/config
Uninstall script is located at /home/unix_user/.hal/uninstall.sh
Running ubuntu 18.04
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]

# 以下延々と続く

The halyard daemon isn't running yet... starting it manually..
1.19.2-20190417142815

Would you like to configure halyard to use bash auto-completion? [default=Y]: Y
```

確認

```bash
$ hal -v
1.19.2-20190417142815
```

# アンインストール
[これも公式通りに](https://www.spinnaker.io/setup/install/halyard/#uninstall-halyard-from-debianubuntu-or-macos)

```bash
$ sudo ~/.hal/uninstall.sh
[sudo] password for unix_user:
This script uninstalls Halyard and deletes all of its artifacts, are you sure you want to continue? (Y/n): Y
Deleting halconfig and artifacts

$ hal -v
-bash: /usr/local/bin/hal: No such file or directory
```

# ansible でインストールしたい場合
対話式でない方式にすれば行けます。
つまり `--user <user名> -y`を付ければok。
[ソースコード](https://github.com/spinnaker/halyard/blob/master/install/Installer.sh)

>
>```bash:インストールオプションの一部(引用)
>    -y                              Accept all default options during install
>                                    (non-interactive mode).
>
>    --user <user>                   Specify the user to run Halyard as. This
>                                    user must exist.
>```

```yaml:ansibleでHalyardインストール
$ cat spinnaker.yaml
- hosts: localhost
  tasks:
    - name: Download Halyard
      get_url:
        url: https://raw.githubusercontent.com/spinnaker/halyard/master/install/debian/InstallHalyard.sh
        dest: /tmp/InstallHalyard.sh # ディレクトリはどこでも大丈夫なはず

    - name: install Halyard
      become: yes # sudoで実行。rootユーザーで実行しないとエラーになります。
      shell: bash /tmp/InstallHalyard.sh --user unix_user -y # --user は実在のユーザーで

$ ansible-playbook spinnaker.yaml --ask-become-pass
SUDO password:
 [WARNING]: Unable to parse /etc/ansible/hosts as an inventory source
 [WARNING]: No inventory was parsed, only implicit localhost is available
 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [localhost] ************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************************************************************************
ok: [localhost]

TASK [Download Halyard] *****************************************************************************************************************************************************************************************
changed: [localhost]

TASK [install Halyard] ******************************************************************************************************************************************************************************************
changed: [localhost]

PLAY RECAP ******************************************************************************************************************************************************************************************************
localhost                  : ok=3    changed=2    unreachable=0    failed=0
```

確認

```bash
$ hal -v
1.19.2-20190417142815
```