An error occurs when installing nginx on an executable.

Asked 2 years ago, Updated 2 years ago, 161 views

I'd like to install nginx on yaml of the answer, but I get an error.
I will put the contents of the yaml where the error occurred, so I would appreciate it if you could tell me how to resolve it.

main.yml

-name:nginx install
  shell —yum install nginx
  args:
    warn —no

Error

fatal: [Client01]: FAILED! => {
  "changed": true,
  "cmd": "yum -y install nginx",
  "delta": "0:00:00.651993",
  "end": "2020-09-05 13:06:43.982719",
  "msg": "non-zero return code",
  "rc": 1,
  "start": "2020-09-05 13:06:43.330726",
  "stderr": "Error: Nothing to do",
  "stderr_lines": [
    "Error: Nothing to do"
  ],
  "stdout": "Loaded plugins: extras_suggestions, langpacks, priorities, update-motd\nNo package nginx available.\n\n\nnginx is available in Amazon Linux Extra topics \"nginx1.12\" and \"nginx1\"\n\nTo use, run\n# sudo amazon-linux-extras install :topic:\n\nLearn more at\nhttps://aws.amazon.com/amazon-linux-2/faqs/#Amazon_Linux_Extras",
  "stdout_lines": [
    "Loaded plugins: extras_suggestions, langpacks, priorities, update-motd",
    "No package nginx available.",
    "",
    "",
    "nginx is available in Amazon Linux Extra topics \"nginx1.12\" and \"nginx1\"",
    "",
    "To use, run",
    "# sudo amazon-linux-extras install:topic:",
    "",
    "Learn more at",
    "https://aws.amazon.com/amazon-linux-2/faqs/ #Amazon_Linux_Extras"
  ]
}

I have tried other installation methods such as the following, but an error occurred and I cannot install them.

-name:nginx install
  yum:
    name —nginx
    state —Latest
-name:install nginx
  package:
    name —nginx
    state —present

aws ansible amazon-linux

2022-09-30 16:22

1 Answers

I think you have the information you need to know how to deal with the error message.

nginx is available in Amazon Linux Extratopics "nginx 1.12" and "nginx 1"

To use, run

# sudo amazon-linux-extras install:topic:

Learn more at
https://aws.amazon.com/amazon-linux-2/faqs/ #Amazon_Linux_Extras

Amazon Linux treats some applications (packages) as "Amazon Linux Extras", and you must use the amazon-linux-extras command to install them.

If you want to install Nginx, you can specify "nginx1.12" or "nginx1" as the package name.

$sudo amazon-linux-extras install nginx1


2022-09-30 16:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.