AnsibleでRundeck環境を構築する

Rundeck実行環境をAnsibleで構築できるようにしました。
いくつかアンチパターンがあると思いつつ。。記録として投稿します。

## Ansible実行環境
- Ubuntu 20.04
- Ansible 2.12.7 
- Python 3.8.10

## Rundeck構築環境
- Ubuntu 20.04
- Python 3.8.5
- `10.0.0.8`

## hosts, Playbook
- hosts
```
[rundeck]
10.0.0.8
```
- rundeck-install.yaml
RundeckとAnsibleをインストールします  
```yaml
- name: rundeck
  hosts: 
  become: true
  tasks:
    - name: install openjdk
      apt:
        name: openjdk-11-jre-headless
        update_cache: yes
    - name: pre1-1
      get_url:
        url: https://raw.githubusercontent.com/rundeck/packaging/main/scripts/deb-setup.sh
        dest: ~/
    - name: pre1-2
      shell: /bin/bash ~/deb-setup.sh rundeck
    - name: pre1-3
      shell:
        curl -L https://packages.rundeck.com/pagerduty/rundeck/gpgkey | sudo apt-key add -
    - name: install rundeck
      apt:
        name: rundeck
        update_cache: yes
    - name: rundeck service start
      systemd:
        name: rundeckd
        state: started
        enabled: yes
    - name: pre2-1
      apt:
        name: software-properties-common
        update_cache: yes
    - name: pre2-2
      shell:
        apt-add-repository --yes --update ppa:ansible/ansible
    - name: install ansible
      apt:
        name: ansible
```
## 実行コマンド
`ansible-playbook rundeck-install.yaml -i hosts`

## 実行結果
```bash
aki-nasu@controller-vm:~$ ansible-playbook rundeck-install.yaml -i hosts
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

PLAY [rundeck] ******************************************************************************************************

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

TASK [install openjdk] **********************************************************************************************
ok: [10.0.0.8]

TASK [pre1-1] *******************************************************************************************************
ok: [10.0.0.8]

TASK [pre1-2] *******************************************************************************************************
changed: [10.0.0.8]

TASK [pre1-3] *******************************************************************************************************
changed: [10.0.0.8]

TASK [install rundeck] **********************************************************************************************
ok: [10.0.0.8]

TASK [rundeck service start] ****************************************************************************************
ok: [10.0.0.8]

TASK [pre2-1] *******************************************************************************************************
ok: [10.0.0.8]

TASK [pre2-2] *******************************************************************************************************
changed: [10.0.0.8]

TASK [install ansible] **********************************************************************************************
changed: [10.0.0.8]

PLAY RECAP **********************************************************************************************************
10.0.0.8                   : ok=10   changed=4    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

aki-nasu@controller-vm:~$
```

## 参考
- [Installing on Ubuntu or Debian Linux distributions](https://docs.rundeck.com/docs/administration/install/linux-deb.html)