最初の実行時に、Ansible ロールの「ネットワークの作成」ステップで次のエラーが発生し続けます。ansible スクリプトを実行するたびに、動作しているようです。何か不足していますか?docker の開始にはさらに時間が必要ですか?
fatal: [192.168.1.102]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on test's Python /usr/bin/python3. Please read module documentation and install in the appropriate location, for example via `pip install docker` or `pip install docker-py` (Python 2.6). The error was: No module named 'docker'"}
Ansible ドッカーの役割:
- name: Install aptitude using apt.
apt:
name: aptitude
state: latest
update_cache: yes
force_apt_get: yes
- name: Install prerequisites.
apt:
name: '{{ packages }}'
update_cache: yes
state: latest
vars:
packages:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- name: Add Docker GPG key.
apt_key:
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add Docker repository.
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable
- name: Install Docker.
apt:
name: '{{ packages }}'
update_cache: yes
state: latest
vars:
packages:
- docker-ce
- docker-compose
- name: Create "docker" group.
group:
name: docker
state: present
- name: Add remote "ubuntu" user to "docker" group.
user:
name: '{{ run_as_user }}'
groups: docker
append: yes
- name: Create a network.
docker_network:
name: '{{ network }}'