311 Configure and start git_daemon

Use case

Install git. Use the role vbotka.freebsd.postinstall to configure and start git_daemon

Tree

shell> tree .
.
├── ansible.cfg
├── host_vars
│   └── iocage_05
│       └── gitserver.yml
├── iocage.ini
└── pb.yml

Synopsis

Requirements

TBD

Notes

TBD

Note

vbotka.freebsd.postinstall is the role postinstall in the collection vbotka.freebsd.
vbotka.freebsd_postinstall is the role freebsd_postinstall in the namespace vbotka.
Please make sure the versions are the same before you switch between them.

See also

ansible.cfg

[defaults]
callback_result_format = yaml
deprecation_warnings = false
display_skipped_hosts = false
gathering = explicit
interpreter_python = auto_silent
log_path = /var/log/ansible.log

[connection]
pipelining = true

Inventory iocage.ini

iocage_05

[iocage]
iocage_05

[iocage:vars]
ansible_user=admin
ansible_become=true
ansible_python_interpreter=auto_silent

host_vars

host_vars/iocage_05/gitserver.yml
fp_gitserver: true
fp_gitserver_dir_mode: '0755'

fp_git_daemon_enable: true
fp_git_daemon_rcconf:
  - { name: git_daemon_directory, value: /usr/local/git }
  - { name: git_daemon_flags, value: --syslog --base-path=/usr/local/git --export-all --reuseaddr --detach }

Playbook pb.yml

- name: Configure and start git_daemon
  hosts: iocage
  gather_facts: true
  remote_user: admin
  become: true

  tasks:

    - name: Install git.
      community.general.pkgng:
        name: git

    - name: Configure and start Git Server.
      ansible.builtin.import_role:
        name: vbotka.freebsd.postinstall
        tasks_from: gitserver.yml

Playbook output - Configure and start git_daemon

(env) > ansible-playbook pb.yml -i iocage.ini
PLAY [Configure and start git_daemon] ******************************************

TASK [Gathering Facts] *********************************************************
ok: [iocage_05]

TASK [Install git.] ************************************************************
ok: [iocage_05]

TASK [vbotka.freebsd.postinstall : Gitserver: Create /usr/local/git] ***********
ok: [iocage_05]

TASK [vbotka.freebsd.postinstall : Rcconf: Configure git_daemon in /etc/rc.conf] ***
ok: [iocage_05] => (item={'name': 'git_daemon_directory', 'value': '/usr/local/git'})
ok: [iocage_05] => (item={'name': 'git_daemon_flags', 'value': '--syslog --base-path=/usr/local/git --export-all --reuseaddr --detach'})

TASK [vbotka.freebsd.postinstall : Rcconf: Configure git_daemon_enable in /etc/rc.conf] ***
ok: [iocage_05]

PLAY RECAP *********************************************************************
iocage_05                  : ok=5    changed=0    unreachable=0    failed=0    skipped=5    rescued=0    ignored=0   

Display service status

shell > ssh admin@iocage_05 service git_daemon status
git_daemon is running as pid 4235.