Home > Net >  Installing httpd through ansible roles - ok=1 instead of changed =1
Installing httpd through ansible roles - ok=1 instead of changed =1

Time:06-13

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

CodePudding user response:

have you started your service?

- name: service httpd started
  service:
    name: "httpd" 
    state: started

CodePudding user response:

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".

  • Related