When running a playbook with sudo escalation, what would the process be to get to this point?
user > sudo -s > su zimbra > zimbra cli
As this is the only way to run commands in the Zimbra CLI
At the moment I have the following... I dont get any errors when running the playbook however nothing happens on the host side.
---
- hosts: mail
become: yes
become_method: sudo
tasks:
- name: Generate CSR
become_user: zimbra
command: zmcertmgr createcsr comm -new -keysize 4096 -digest sha512 -subject "/C="{{cert_c}}"/ST="{{cert_st}}"/L="{{cert_l}}"/O="{{cert_o}}"/OU="{{cert_ou}}"/CN="{{cert_cn}}"" "{{cert_alt}}"
Sorted it out....
Running Zimbra commands via Ansible requires the absolute path to be used:
---
- hosts: mail
become: yes
become_method: sudo
tasks:
- name: Generate CSR
become_user: zimbra
command: /opt/zimbra/bin/zmcertmgr createcsr comm -new -keysize 4096 -digest sha512 -subject "/C="{{cert_c}}"/ST="{{cert_st}}"/L="{{cert_l}}"/O="{{cert_o}}"/OU="{{cert_ou}}"/CN="{{cert_cn}}"" "{{cert_alt}}"