| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- ---
- - name: Add bacula user to enable control by Bacula/Bacularis system
- hosts: all
- gather_facts: true
- become: True
- tasks:
- - name: populate package mgr facts
- package_facts:
- manager: auto
- - name: output package facts
- debug:
- msg:
- # - "{{ ansible_facts ['distribution_file_variety'] }}"
- - name: "install pkg containing lgroupmod, required by module(s) below"
- package:
- name: libuser
- state: present
- #when: "'libuser' not in ansible_facts.packages"
- - name: Add bacula user, Deb-like
- user:
- name: bacula
- comment: "Debian-like- Add bacula user for the Bacula backup system"
- create_home: true
- local: true
- group: "sudo"
- shell: "/bin/bash"
- uid: "133"
- system: false
- generate_ssh_key: false
- password: "$6$0000000000000000$00000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
- expires: -1
- password_expire_max: 99999
- password_expire_min: 0
- password_lock: false
- state: present
- when: ansible_facts['distribution_file_variety'] == "Debian"
- - name: Add bacula user, RH-like
- user:
- name: bacula
- comment: "RH-like- Add bacula user for the Bacula backup system"
- create_home: true
- local: false
- group: "wheel"
- shell: "/bin/bash"
- uid: "133"
- system: true
- generate_ssh_key: false
- password: "$6$0000000000000000$00000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
- expires: -1
- password_expire_max: 99999
- password_expire_min: 0
- password_lock: false
- state: present
- when: ansible_facts['distribution_file_variety'] == "RedHat"
- - name: Add bacula user to the sudoers file
- sudoers:
- commands: ALL
- host: ALL
- name: bacula
- nopassword: True
- state: present
- user: bacula
- validation: detect
- - name: Copy bacula RSA public keys to ~/bacula/.ssh/authorized_keys
- authorized_key:
- user: bacula
- comment: "RSA- ssh keys for the bacula backup user"
- key: "{{ lookup('file', '~/playbooks/bacula/include/bacula-id_rsa.pub') }}"
- state: present
- - name: copy bacula ECDSA public keys to ~/bacula/.ssh/authorized_keys
- authorized_key:
- user: bacula
- comment: "ECDSA- ssh keys for the bacula backup user"
- key: "{{ lookup('file', '~/playbooks/bacula/include/bacula-id_ecdsa.pub') }}"
- state: present
- - name: copy bacula ED25519 public keys to ~/zabbix/.ssh/authorized_keys
- authorized_key:
- user: bacula
- comment: "ED25519- ssh keys for the backup user"
- key: "{{ lookup('file', '~/playbooks/bacula/include/bacula-id_ed25519.pub') }}"
- state: present
|