How to prevent 'changed' flag when 'register'-ing a variable?

后端 未结 2 888
-上瘾入骨i
-上瘾入骨i 2021-01-03 18:24

I have a register task to test for the installation of a package:

tasks:
  - name: test for nginx
    command: dpkg -s nginx-common
    register         


        
2条回答
  •  心在旅途
    2021-01-03 18:55

    It’s described in official documentation here.

    tasks:
      - name: test for nginx
        command: dpkg -s nginx-common
        register: nginx_installed
        changed_when: false
    

提交回复
热议问题