I am trying to write some configuration files to an OpenBSD node.
I have created a remote user: ansible
I have allowed said user to perform as root in /etc/doas.conf
I have tested logging in as well as using doas to become root interactively
The playbook is as follows:
- name: For newer OpenBSD hosts
hosts: obsd_doas
gather_facts: true
become: yes
become_method: community.general.doas
become_user: root
- name: Write the snmp client configuration file
template:
src: "{{ ansible_facts['distribution'] }}_snmpd.j2"
dest: /etc/snmpd.conf
owner: root
group: wheel
mode: '0600'
notify:
- restart snmpd
Using the following command:
$ ansible-playbook -v --limit dns5-new -K snmp.yml
The error message is:
TASK [Gathering Facts] ********************************************************************************************************************************************************************************
ok: [dns5-new]
TASK [Write the snmp client configuration file] *******************************************************************************************************************************************************
fatal: [dns5-new]: FAILED! => {"changed": false, "checksum": "a71ac6e888a48b1caf483e077bd985c6fdbd02e9", "msg": "Destination /etc not writable"}
PLAY RECAP ********************************************************************************************************************************************************************************************
dns5-new : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Tag: playbook, doas