From bc4169ba1cca173abbe084db7e8967d6863079f2 Mon Sep 17 00:00:00 2001 From: Christoph Hartmann Date: Mon, 30 Oct 2023 11:09:17 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20ensure=20os=20provider=20is=20on?= =?UTF-8?q?=20latest=20version=20before=20we=20login?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 +++++++++----- tasks/linux_login.yml | 5 +++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 63c5641..77609f9 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ This playbook demonstrates how to use the Mondoo Package role to install `cnquer - hosts: linux_hosts become: yes roles: - - role: mondoo.client + - role: ansible-mondoo # if used from galaxy: mondoo.client vars: registration_token: "changeme" ``` @@ -76,7 +76,7 @@ In addition we support the following variables: - hosts: linux_hosts become: yes roles: - - role: mondoo.client + - role: ansible-mondoo # if used from galaxy: mondoo.client vars: registration_token: "changeme" force_registration: true @@ -96,7 +96,7 @@ If you want to use cnspec behind a proxy https_proxy: "http://192.168.56.1:3128" roles: - - role: mondoo.client + - role: ansible-mondoo # if used from galaxy: mondoo.client vars: registration_token: "changeme" force_registration: true @@ -107,8 +107,12 @@ If you want to use cnspec behind a proxy 1. Run the playbook with the local hosts file ```bash -# download mondoo role +# download mondoo role from github +ansible-galaxy role install git+https://github.com/mondoohq/ansible-mondoo.git + +# (alternative) download mondoo role from ansible galaxy ansible-galaxy install mondoo.client + # apply the playbook ansible-playbook -i hosts playbook.yml ``` @@ -139,7 +143,7 @@ If you are targeting windows, the configuration is slightly different since `bec ```yaml - hosts: windows_hosts roles: - - role: mondoo.client + - role: ansible-mondoo # if used from galaxy: mondoo.client vars: registration_token: "changeme" force_registration: false diff --git a/tasks/linux_login.yml b/tasks/linux_login.yml index 2984498..afec0bd 100644 --- a/tasks/linux_login.yml +++ b/tasks/linux_login.yml @@ -3,6 +3,11 @@ --- +- name: Ensure we have the latest os provider installed + ansible.builtin.command: cnspec providers install os + become: "{{ use_become }}" + when: not ansible_check_mode + - name: Create mondoo config directory ansible.builtin.file: dest: /etc/opt/mondoo