skip to Main Content

I have created roles to install httpd.

But the status is always ‘ok=1’
instead of ‘changed=1’

How should I actually install httpd and get a status of ‘changed=1’

  master.yml->

- name: playbook
   hosts: webservers
   become: yes
   roles: 
    -tasks

   tasks.yml->

 - name: installing apache latest
    yum: 
     - name: httpd
       state: present

2

Answers


  1. have you started your service?

    - name: service httpd started
      service:
        name: "httpd" 
        state: started
    
    Login or Signup to reply.
  2. this is because you have state "present" in yum-module description.
    how it works: if you have package already installed – status will be "ok", if you have not – status will be "changed".

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search