apt_repository 模块失败
apt_repository module fails ansible
有时当我 运行 我的剧本时它抛出下一个失败:
FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n File \"/root/.ansible/tmp/ansible-tmp-1457967885.72-104659711487416/apt_repository\",
line 3210, in <module>\r\n main()\r\n File \"/root/.ansible/tmp/ansible-tmp-1457967885.72-104659711487416/apt_repository\", line 469, in main\r\n` `cache.update()\r\n File \"/usr/lib/python2.7/dist-packages/apt/cache.py\", line 440,
in update\r\n raise FetchFailedException(e)\r\napt.cache.FetchFailedException: W:Imposible obtener` `http://security.ubuntu.com/ubuntu/dists/trusty-security/main/source/Sources` `La suma hash difiere\r\n,
W:Imposible obtener http://security.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages La suma hash difiere\r\n, W:Imposible obtener http://security.ubuntu.com/ubuntu/dists/trusty-security/main/binary-i386/Packages La suma hash difiere\r\n,
E:Algunos archivos de` `índice fallaron al descargar. Se han ignorado, o se han utilizado unos` `antiguos en su lugar\r\n",
"msg": "MODULE FAILURE", "parsed": false}
剧本中 'sometimes' 失败的部分是下一个:
- name: ppa java8
apt_repository: repo=ppa:webupd8team/java state=present update_cache=yes
运行 sudo apt-get -y clean && sudo apt-get -y autoclean
在你的任务之前。
v1。到处使用 update_cache: no
。
ansible 2.5.2
,远程主机:ubuntu 18.04
- name: Install MySQL utilities and workbench 4 Ubuntu
when:
- ansible_distribution == 'Ubuntu'
- ansible_architecture == 'x86_64'
become: yes
block:
- apt:
update_cache: no
- apt_repository:
repo: deb http://repo.mysql.com/apt/ubuntu/ {{ ansible_distribution_release }} mysql-apt-config
state: present
filename: mysql
update_cache: no
- apt_repository:
repo: deb http://repo.mysql.com/apt/ubuntu/ {{ ansible_distribution_release }} mysql-tools
state: present
filename: mysql
update_cache: no
- apt_key:
# url: http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x8C718D3B5072E1F5
keyserver: pool.sks-keyservers.net
id: 8C718D3B5072E1F5
state: present
- debconf:
name: mysql-apt-config
question: select-product
vtype: select
value: Ok
- debconf:
name: mysql-apt-config
question: select-tools
vtype: select
value: Enabled
- debconf:
name: mysql-apt-config
question: repo-distro
vtype: select
value: ubuntu
- debconf:
name: mysql-apt-config
question: tools-component
vtype: select
value: mysql-tools
- debconf:
name: mysql-apt-config
question: repo-url
vtype: select
value: http://repo.mysql.com/apt
- debconf:
name: mysql-apt-config
question: select-server
vtype: select
value: mysql-{{ mysql_version }}
- apt:
update_cache: yes
- apt:
name: "{{ item }}"
state: latest
install_recommends: yes
force: yes
with_items:
- mysql-apt-config
- mysql-utilities
- mysql-workbench
- name: Install MySQL CLI 4 Ubuntu
when:
- ansible_distribution == 'Ubuntu'
- ansible_architecture == 'x86_64'
become: yes
block:
- apt:
update_cache: no
- apt_repository:
repo: deb https://packagecloud.io/amjith/mycli/ubuntu/ {{ ansible_distribution_release }} main
filename: amjith_mycli
update_cache: no
- apt_key:
url: https://packagecloud.io/amjith/mycli/gpgkey
state: present
- apt:
update_cache: yes
- apt:
name: mycli
state: latest
Bug回来了。
v2。首先添加一个新密钥 (UPD 20-10-2020)。
- apt_key:
# url: http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x8C718D3B5072E1F5
keyserver: pool.sks-keyservers.net
id: 8C718D3B5072E1F5
state: present
- apt_repository:
repo: deb http://repo.mysql.com/apt/ubuntu/ {{ ansible_distribution_release }} mysql-apt-config
state: present
filename: mysql
- apt_repository:
repo: deb http://repo.mysql.com/apt/ubuntu/ {{ ansible_distribution_release }} mysql-tools
state: present
filename: mysql
有时当我 运行 我的剧本时它抛出下一个失败:
FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n File \"/root/.ansible/tmp/ansible-tmp-1457967885.72-104659711487416/apt_repository\",
line 3210, in <module>\r\n main()\r\n File \"/root/.ansible/tmp/ansible-tmp-1457967885.72-104659711487416/apt_repository\", line 469, in main\r\n` `cache.update()\r\n File \"/usr/lib/python2.7/dist-packages/apt/cache.py\", line 440,
in update\r\n raise FetchFailedException(e)\r\napt.cache.FetchFailedException: W:Imposible obtener` `http://security.ubuntu.com/ubuntu/dists/trusty-security/main/source/Sources` `La suma hash difiere\r\n,
W:Imposible obtener http://security.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages La suma hash difiere\r\n, W:Imposible obtener http://security.ubuntu.com/ubuntu/dists/trusty-security/main/binary-i386/Packages La suma hash difiere\r\n,
E:Algunos archivos de` `índice fallaron al descargar. Se han ignorado, o se han utilizado unos` `antiguos en su lugar\r\n",
"msg": "MODULE FAILURE", "parsed": false}
剧本中 'sometimes' 失败的部分是下一个:
- name: ppa java8
apt_repository: repo=ppa:webupd8team/java state=present update_cache=yes
运行 sudo apt-get -y clean && sudo apt-get -y autoclean
在你的任务之前。
v1。到处使用 update_cache: no
。
ansible 2.5.2
,远程主机:ubuntu 18.04
- name: Install MySQL utilities and workbench 4 Ubuntu
when:
- ansible_distribution == 'Ubuntu'
- ansible_architecture == 'x86_64'
become: yes
block:
- apt:
update_cache: no
- apt_repository:
repo: deb http://repo.mysql.com/apt/ubuntu/ {{ ansible_distribution_release }} mysql-apt-config
state: present
filename: mysql
update_cache: no
- apt_repository:
repo: deb http://repo.mysql.com/apt/ubuntu/ {{ ansible_distribution_release }} mysql-tools
state: present
filename: mysql
update_cache: no
- apt_key:
# url: http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x8C718D3B5072E1F5
keyserver: pool.sks-keyservers.net
id: 8C718D3B5072E1F5
state: present
- debconf:
name: mysql-apt-config
question: select-product
vtype: select
value: Ok
- debconf:
name: mysql-apt-config
question: select-tools
vtype: select
value: Enabled
- debconf:
name: mysql-apt-config
question: repo-distro
vtype: select
value: ubuntu
- debconf:
name: mysql-apt-config
question: tools-component
vtype: select
value: mysql-tools
- debconf:
name: mysql-apt-config
question: repo-url
vtype: select
value: http://repo.mysql.com/apt
- debconf:
name: mysql-apt-config
question: select-server
vtype: select
value: mysql-{{ mysql_version }}
- apt:
update_cache: yes
- apt:
name: "{{ item }}"
state: latest
install_recommends: yes
force: yes
with_items:
- mysql-apt-config
- mysql-utilities
- mysql-workbench
- name: Install MySQL CLI 4 Ubuntu
when:
- ansible_distribution == 'Ubuntu'
- ansible_architecture == 'x86_64'
become: yes
block:
- apt:
update_cache: no
- apt_repository:
repo: deb https://packagecloud.io/amjith/mycli/ubuntu/ {{ ansible_distribution_release }} main
filename: amjith_mycli
update_cache: no
- apt_key:
url: https://packagecloud.io/amjith/mycli/gpgkey
state: present
- apt:
update_cache: yes
- apt:
name: mycli
state: latest
Bug回来了。
v2。首先添加一个新密钥 (UPD 20-10-2020)。
- apt_key:
# url: http://pool.sks-keyservers.net/pks/lookup?op=get&search=0x8C718D3B5072E1F5
keyserver: pool.sks-keyservers.net
id: 8C718D3B5072E1F5
state: present
- apt_repository:
repo: deb http://repo.mysql.com/apt/ubuntu/ {{ ansible_distribution_release }} mysql-apt-config
state: present
filename: mysql
- apt_repository:
repo: deb http://repo.mysql.com/apt/ubuntu/ {{ ansible_distribution_release }} mysql-tools
state: present
filename: mysql