ghostrunner
ghostrunner

Reputation: 23

Ansible "No package matching 'nginx' found available, installed or updated"

I want to install and run nginx server using ansible on ec2 instance(centOS). But I have following problem

Output of problem

fatal: [ec2-user]: FAILED! => {"changed": false, "msg": "No package matching 'nginx' found available, installed or updated", "rc": 126, "results": ["No package matching 'nginx' found available, installed or updated"]}

my playbook:

---
- hosts: all
  tasks:
    - name: install updates
      yum: name=* state=latest
    - name: install nginx
      become: yes
      yum: name=nginx state=latest
    - name: starting nginx
      become: yes
      service: name=nginx state=started

Upvotes: 1

Views: 3091

Answers (1)

Romain
Romain

Reputation: 21918

Nginx is not available in the standard repositories of CentOS. You need first to enable the EPEL repo to install nginx.

# enable EPEL repo by installing the epel-release package
- name: install EPEL repo
  become: yes
  yum: name=epel-release state=present

Upvotes: 3

Related Questions