minor fixes (entrypoint) and restructuring

This commit is contained in:
2021-06-08 12:28:09 +02:00
parent aef1499e65
commit ea3195a93c
4 changed files with 51 additions and 26 deletions

View File

@@ -74,4 +74,6 @@
tags: docker
- name: "install cobald"
role: cobald
vars:
docker_network: slurm
tags: cobald

View File

@@ -45,7 +45,7 @@ COPY cobald-entrypoint.sh /usr/local/sbin/docker-entrypoint.sh
RUN chmod 755 /usr/local/sbin/docker-entrypoint.sh
ENTRYPOINT /usr/local/sbin/docker-entrypoint.sh
ENTRYPOINT [ "/usr/local/sbin/docker-entrypoint.sh" ]
RUN yum -y install iproute &&\
yum clean all && rm -rf /var/cache/yum

View File

@@ -38,9 +38,6 @@
group: docker
when: False
- set_fact:
docker_network: slurm
- docker_network:
name: "{{docker_network}}"
state: present
@@ -51,10 +48,21 @@
name: git
state: present
- file:
path: "{{item}}"
owner: "{{unpriv_user}}"
group: "{{unpriv_user}}"
mode: "a=rx,u=rwx"
state: directory
with_items:
- "~{{unpriv_user}}/cobald/modules"
- "~{{unpriv_user}}/cobald"
- git:
repo: https://github.com/thoto/cobald
dest: "~{{unpriv_user}}/cobald-src"
version: bugfix/mixed_construction_methods
update: no
become: yes
become_user: "{{unpriv_user}}"
register: cobald_git_pull
@@ -72,10 +80,6 @@
database: passwd
key: "{{unpriv_user}}"
- import_tasks: telegraf.yml
vars:
docker_network: cobald
- name: run pip install
docker_container:
image: cobald
@@ -96,10 +100,18 @@
run: "{{tardis_git_pull.changed}}"
when: item.run
- import_tasks: telegraf.yml
- docker_container_info:
name: cobald
register: cobald_container_info
- docker_container:
name: cobald
image: cobald
hostname: cobald
hostname: |-
{{cobald_container_info.container.Config.Hostname | default('cobald-'+
lookup('password', '/dev/null chars=ascii_lowercase')) }}
domainname: cobald.local
volumes:
- "~{{unpriv_user}}/cobald:/etc/cobald"
@@ -113,4 +125,6 @@
detach: True
cleanup: True
interactive: True
command: /bin/bash
# command: /bin/bash
# python3 -m cobald.daemon /etc/cobald/config.yaml
command: python3 -m cobald.daemon /etc/cobald/config.yaml

View File

@@ -20,7 +20,8 @@
owner: "{{unpriv_user}}"
group: docker
- docker_image:
- name: docker image for telegraf
docker_image:
name: "ed-telegraf"
build:
pull: False
@@ -28,25 +29,32 @@
source: build
force_source: "{{cobald_cp_telegraf_dockerfile.changed}}"
- block:
- import_tasks: influxdb.yml
- set_fact:
influx_hostname: "ed-influxdb"
influx_domainname: "cobald.local"
influx_bucket: batleth
tags: influxdb
- template:
- import_tasks: influxdb.yml
tags: influxdb
- set_fact:
# influx_url: "http://{{influx_hostname}}.{{influx_domainname}}:8086"
influx_url: "http://{{influx_hostname}}:8086"
tags: influxdb
- name: generate telegraf config
template:
src: telegraf.conf.j2
dest: /container/volumes/telegraf/telegraf.conf
owner: "{{unpriv_user}}"
group: docker
vars:
# influx_url: "http://{{influx_hostname}}.{{influx_domainname}}:8086"
influx_url: "http://{{influx_hostname}}:8086"
influx_token: "{{influx_telegraf_token.token}}"
vars:
influx_hostname: "ed-influxdb"
influx_domainname: "cobald.local"
influx_bucket: batleth
register: telegraf_config_gen
- docker_container:
- name: run telegraf container
docker_container:
name: ed-telegraf
image: ed-telegraf
hostname: telegraf
@@ -56,6 +64,7 @@
volumes:
- "/container/volumes/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro"
state: started
recreate: "{{ telegraf_config_gen.changed | default(False) | bool }}"
detach: True
# cleanup: True
networks_cli_compatible: True