备忘录:在CircleCI上安装Ansible到Docker镜像时出现错误
-
- circleciで、docker imageにansibleインストールした時にエラーが出る。
-
- イメージはcircleci/python:3.7.1。Dockerfileを見るとbaseはubuntu。
- 公式ドキュメントでは以下のようになっていたので、それを参考ししたが、
sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible
sudo apt-add-repository ppa:ansible/ansibleでエラーが出る。
gpg: keybox '/tmp/tmp6ah87frz/pubring.gpg' created
gpg: /tmp/tmp6ah87frz/trustdb.gpg: trustdb created
gpg: key *******: public key "Launchpad PPA for Ansible, Inc." imported
gpg: Total number processed: 1
gpg: imported: 1
gpg: no valid OpenPGP data found.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 688, in addkey_func
func(**kwargs)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 386, in add_key
return apsk.add_ppa_signing_key()
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 273, in add_ppa_signing_key
cleanup(tmp_keyring_dir)
File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 234, in cleanup
shutil.rmtree(tmp_keyring_dir)
File "/usr/lib/python3.5/shutil.py", line 480, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.5/shutil.py", line 438, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib/python3.5/shutil.py", line 436, in _rmtree_safe_fd
os.unlink(name, dir_fd=topfd)
FileNotFoundError: [Errno 2] No such file or directory: 'S.gpg-agent.ssh'
-
- gpgの何かがインストールができない模様。
- 原因はわからないが、このイメージだと最後のinstall ansibleだけでもインストールはできるので、直でansibleのinstallだけをすることにした。
executors:
ansible:
docker:
- image: circleci/python:3.7.1
working_directory: /home/circleci
version: 2.1
jobs:
install_ansible:
executor: ansible
steps:
- run:
name: Install ansible
command: |
sudo apt-get update
sudo apt-get install -y ansible
- 上は本来のcircleciのconfig.ymlの抜粋なのでお気をつけあれ。