V
V
Vlad Tkachuk2020-06-21 21:19:45
Ansible
Vlad Tkachuk, 2020-06-21 21:19:45

How to solve the error in the playbook file?

5eefa47191e4b576846931.png

5eefa47859e90618769566.png

Just the other day I started to study Ansible, wrote a simple playbook to install Apache on all my hosts (2 instances raised in Amazon), I get the following error, I feel that something simple, but I myself have not noticed the error yet

Playbook: - name: Install default Apache Web Server
hosts: all
become: yes

tasks:
- name: Install Apache WebServer
apt: name=httpd state=latest

- name: Start Apache and Enable it on the every boot
service: name=httpd state=started enabled=yes

Error: fatal: [linux1]: FAILED! => {"cache_update_time": 1586367636, "cache_updated": false, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=-- force-confdef\" -o \"Dpkg::Options::=--force-confold\" install 'httpd'' failed: E: Package 'httpd' has no installation candidate\n", "rc": 100, "stderr": "E: Package 'httpd' has no installation candidate\n", "stderr_lines": ["E: Package 'httpd' has no installation candidate"], "stdout": "Reading package lists...\ nBuilding dependency tree...\nReading state information...\nPackage httpd is a virtual package provided by:\n nginx-core 1.14.0-0ubuntu1.7\n apache2 2.4.29-1ubuntu4.13\n\n" , "
fatal: [linux2]: FAILED! => {"cache_update_time": 1586367636, "cache_updated": false, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=-- force-confdef\" -o \"Dpkg::Options::=--force-confold\" install 'httpd'' failed: E: Package 'httpd' has no installation candidate\n", "rc": 100, "stderr": "E: Package 'httpd' has no installation candidate\n", "stderr_lines": ["E: Package 'httpd' has no installation candidate"], "stdout": "Reading package lists...\ nBuilding dependency tree...\nReading state information...\nPackage httpd is a virtual package provided by:\n nginx-core 1.14.0-0ubuntu1.7\n apache2 2.4.29-1ubuntu4.13\n\n" , "stdout_lines":

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-06-21
@rock3t

Make mistakes in the form of text. Looking at blurry screenshots is not very fun.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question