Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ | Rejoignez-nous sur le Chat 💬

Skip to content

Support ansible check mode

Request

It would be helpful if these roles would support ansible's "check mode" which is like a dry-run.

Implemented; tested; merge request

The only thing required to support check mode, it seems from my testing, is to set check_mode: false in data-gathering steps.

I have fixed this in my own git lab fork, and tested it. I have generated a remote merge-request using the standard git request-pull command like this:

$ git request-pull -p HEAD^ https://lab.trax.im/fork/froggit/lydra/yunohost/ansible-yunohost.git support-ansible-check-mode

and here it is:

The following changes since commit 8554279b42db06fb47942cfb3ebf2c08cf71da49:

  Merge branch '84-build-create-ansible-galaxy-build-1-1-4' into 'main' (2023-03-14 15:13:14 +0000)

are available in the Git repository at:

  https://lab.trax.im/fork/froggit/lydra/yunohost/ansible-yunohost.git support-ansible-check-mode

for you to fetch changes up to 1e63f6c1e1938c93f4bc1ff9a3c0d61f869d0895:

  support ansible check mode (2023-04-26 18:59:33 +0100)

----------------------------------------------------------------
Julian Foad (1):
      support ansible check mode

 roles/ynh_apps/tasks/apps.yml         | 1 +
 roles/ynh_config/tasks/smtp_relay.yml | 1 +
 roles/ynh_setup/tasks/domains.yml     | 1 +
 roles/ynh_setup/tasks/users.yml       | 1 +
 4 files changed, 4 insertions(+)

diff --git a/roles/ynh_apps/tasks/apps.yml b/roles/ynh_apps/tasks/apps.yml
index 240a6df..a2f69f6 100644
--- a/roles/ynh_apps/tasks/apps.yml
+++ b/roles/ynh_apps/tasks/apps.yml
@@ -22,6 +22,7 @@
   ansible.builtin.command: yunohost app map --output-as json
   register: ynh_installed_apps_raw
   changed_when: False
+  check_mode: False
   tags: apps
 
 - name: Format json of apps
diff --git a/roles/ynh_config/tasks/smtp_relay.yml b/roles/ynh_config/tasks/smtp_relay.yml
index a3f68b3..3ea8ca9 100644
--- a/roles/ynh_config/tasks/smtp_relay.yml
+++ b/roles/ynh_config/tasks/smtp_relay.yml
@@ -23,6 +23,7 @@
     "yunohost settings get smtp.relay.{{ item.key }}"
   register: _ynh_smtp_current_values
   changed_when: false
+  check_mode: false
   tags:
     - yunohost
     - smtp
diff --git a/roles/ynh_setup/tasks/domains.yml b/roles/ynh_setup/tasks/domains.yml
index 02a2368..e8a4d2d 100644
--- a/roles/ynh_setup/tasks/domains.yml
+++ b/roles/ynh_setup/tasks/domains.yml
@@ -22,6 +22,7 @@
   ansible.builtin.command: yunohost domain list --output-as json
   register: ynh_installed_domains_raw
   changed_when: False
+  check_mode: False
   tags:
     - yunohost
     - domains
diff --git a/roles/ynh_setup/tasks/users.yml b/roles/ynh_setup/tasks/users.yml
index 84cbc56..19b1c78 100644
--- a/roles/ynh_setup/tasks/users.yml
+++ b/roles/ynh_setup/tasks/users.yml
@@ -22,6 +22,7 @@
   ansible.builtin.command: yunohost user list --output-as json
   register: ynh_registered_users_raw
   changed_when: False
+  check_mode: False
   tags:
     - yunohost
     - users

You can apply the merge in your local repo, if you accept it, like this:

git pull https://lab.trax.im/fork/froggit/lydra/yunohost/ansible-yunohost.git support-ansible-check-mode

I hope you find this useful. Please let me know if you prefer anything different.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information