Здравствуйте.
Разбираюсь с Ansible и ролями.
Создал роль для установки Apache.
Как отдельный плейбук запускается без проблем, но как роль нормально не отрабатывает.
Ошибка:
ansible-playbook playbook_roles_apache.yml
PLAY [Install Apache] ************************************************************************************************************************************************************************************************************************
TASK [Gathering Facts] ***********************************************************************************************************************************************************************************************************************
[WARNING]: Platform linux on host debvm is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information.
ok: [debvm]
ok: [vps-ubuntu]
ok: [centosvm]
TASK [deploy_apache : Install Apache] ********************************************************************************************************************************************************************************************************
fatal: [debvm]: FAILED! => {"ansible_facts": {"pkg_mgr": "apt"}, "changed": false, "msg": "value of state must be one of: absent, build-dep, fixed, latest, present, got: installed"}
fatal: [vps-ubuntu]: FAILED! => {"ansible_facts": {"pkg_mgr": "apt"}, "changed": false, "msg": "value of state must be one of: absent, build-dep, fixed, latest, present, got: installed"}
ok: [centosvm]
TASK [deploy_apache : Apache UP] *************************************************************************************************************************************************************************************************************
ok: [centosvm]
TASK [deploy_apache : Install Apache Debian] *************************************************************************************************************************************************************************************************
[WARNING]: Updating cache and auto-installing missing dependency: python-apt
fatal: [centosvm]: FAILED! => {"changed": false, "cmd": "apt-get update", "msg": "[Errno 2] Нет такого файла или каталога", "rc": 2}
PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
centosvm : ok=3 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
debvm : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
vps-ubuntu : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
В роли у меня только task.
---
# tasks file for deploy_apache
- block: #Block for Centos
- name: Install Apache
yum: name=httpd state=installed
- name: Apache UP
service: name=httpd state=started enabled=yes
when: ansible_os_family == "RedHat"
- block: #Block for Debian
- name: Install Apache Debian
apt: name=apache2 update_cache=yes state=latest
- name: Apache UP Debian
service: name=apache2 state=started enabled=yes
when: ansible_os_family == "Debian"
Подскажите, что делаю не так?