From 9e38736b93a6b737ecb53d1f41dadf45cbb22c1c Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Fri, 25 Oct 2019 00:19:07 +0200 Subject: Various stuff to pre-configure compute nodes --- roles/ands_pods/tasks/compute.yml | 6 ++++++ roles/ands_pods/tasks/main.yml | 24 +++++++++++++++++++++++ roles/ands_pods/templates/services/distcc.service | 17 ++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 roles/ands_pods/tasks/compute.yml create mode 100644 roles/ands_pods/tasks/main.yml create mode 100644 roles/ands_pods/templates/services/distcc.service (limited to 'roles/ands_pods') diff --git a/roles/ands_pods/tasks/compute.yml b/roles/ands_pods/tasks/compute.yml new file mode 100644 index 0000000..649a6e0 --- /dev/null +++ b/roles/ands_pods/tasks/compute.yml @@ -0,0 +1,6 @@ +- name: Start DistCC daemon + systemd: name="distcc" daemon_reload="yes" state="restarted" enabled="yes" + become: yes + +- name: Open DistCC port + firewalld: port="3632/tcp" state="enabled" permanent="true" immediate="true" diff --git a/roles/ands_pods/tasks/main.yml b/roles/ands_pods/tasks/main.yml new file mode 100644 index 0000000..755377e --- /dev/null +++ b/roles/ands_pods/tasks/main.yml @@ -0,0 +1,24 @@ +#- name: Install monitoring applications +# package: name={{item}} state=present +# with_items: +# - sysstat + +- name: "Deploy services" + copy: src="{{ item | quote }}" dest="/etc/systemd/system/{{ item | basename | quote }}" owner=root group=root mode=0755 + with_fileglob: + - "{{ role_path }}/templates/services/*.service" + +- name: "Deploy service templates" + template: src="{{ item | quote }}" dest="/etc/systemd/system/{{ script_name }}" owner=root group=root mode=0755 + vars: + script_name: "{{ item | basename | regex_replace('\\.j2','') }}" + with_fileglob: + - "{{ role_path }}/templates/services/*.j2" + +- name: Configure services on compute nodes + include_tasks: compute.yml + when: "'compute' in group_names" + +- name: Reload SystemD service + systemd: daemon_reload="yes" + become: yes diff --git a/roles/ands_pods/templates/services/distcc.service b/roles/ands_pods/templates/services/distcc.service new file mode 100644 index 0000000..a754fb4 --- /dev/null +++ b/roles/ands_pods/templates/services/distcc.service @@ -0,0 +1,17 @@ +[Unit] +Description=DistCC Podman Container +After=network.target + +[Service] +Type=simple +TimeoutStartSec=5m +ExecStartPre=-/usr/bin/podman rm "distcc" +ExecStart=/usr/bin/podman run --name distcc -p 3632:3632 chsa/distcc:latest +ExecReload=-/usr/bin/podman stop "distcc" +ExecReload=-/usr/bin/podman rm "distcc" +ExecStop=-/usr/bin/podman stop "distcc" +Restart=always +RestartSec=30 + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3