cleanup
This commit is contained in:
98
docker_htcondor.yml
Normal file
98
docker_htcondor.yml
Normal file
@@ -0,0 +1,98 @@
|
||||
- name: "htcondor docker image"
|
||||
file:
|
||||
path: "/container/docker-images/htcondor"
|
||||
state: directory
|
||||
owner: thoto
|
||||
group: docker
|
||||
mode: "u=rwx,g=rwx,o=rx"
|
||||
|
||||
- copy:
|
||||
dest: "/container/docker-images/htcondor/Dockerfile"
|
||||
src: "htcondor.Dockerfile"
|
||||
owner: thoto
|
||||
group: docker
|
||||
register: cp_dockerfile
|
||||
|
||||
- docker_image:
|
||||
name: "htcondor"
|
||||
# pull: False
|
||||
build:
|
||||
pull: False
|
||||
path: "/container/docker-images/htcondor"
|
||||
source: build
|
||||
force_source: "{{cp_dockerfile.changed}}"
|
||||
|
||||
- name: "copy htcondor container configuration"
|
||||
copy:
|
||||
src: "conf/{{item}}/"
|
||||
dest: "/container/volumes/{{item}}/"
|
||||
owner: thoto
|
||||
group: docker
|
||||
mode: "u=rwx,g=rwx"
|
||||
with_items: [ "cm", "exec", "sub", "common"]
|
||||
|
||||
- name: "check if pool shared secret exists"
|
||||
stat:
|
||||
path: "/container/volumes/common/passwords.d/POOL"
|
||||
register: pool_pw
|
||||
|
||||
- block:
|
||||
- name: "create temporary password store"
|
||||
tempfile:
|
||||
state: directory
|
||||
register: pool_pw_tmp
|
||||
|
||||
- name: "generate pool password"
|
||||
copy:
|
||||
dest: "{{pool_pw_tmp.path}}/poolpw"
|
||||
content: "{{lookup('password','/dev/null')}}"
|
||||
no_log: True
|
||||
|
||||
- name: "install pool password"
|
||||
docker_container:
|
||||
name: "condor-common"
|
||||
image: htcondor
|
||||
state: started
|
||||
volumes:
|
||||
- "/container/volumes/common/:/etc/condor/:rw"
|
||||
- "{{pool_pw_tmp.path}}:/tmp/poolpw:ro"
|
||||
detach: False
|
||||
cleanup: True
|
||||
command: "condor_store_cred add -c -i /tmp/poolpw/poolpw"
|
||||
|
||||
always:
|
||||
- name: "remove temporary password store"
|
||||
file:
|
||||
path: "{{pool_pw_tmp.path}}"
|
||||
state: absent
|
||||
when: pool_pw_tmp is defined and pool_pw_tmp.path
|
||||
when: not pool_pw.stat.exists
|
||||
|
||||
- name: "sync common files to individual containers"
|
||||
copy:
|
||||
remote_src: True
|
||||
force: True
|
||||
src: "/container/volumes/common/"
|
||||
dest: "/container/volumes/{{item}}/"
|
||||
with_items: [ "cm", "exec", "sub"]
|
||||
|
||||
- name: "run htcondor containers"
|
||||
docker_container:
|
||||
name: "condor-cm"
|
||||
image: htcondor
|
||||
state: started
|
||||
detach: True
|
||||
cleanup: True
|
||||
volumes:
|
||||
- "/container/volumes/cm/:/etc/condor/:rw"
|
||||
# auto_remove: True
|
||||
# mounts:
|
||||
# src: /container/volumes/cm/
|
||||
# dest: /etc/condor/
|
||||
|
||||
|
||||
#- add_host:
|
||||
# hostname: foo
|
||||
# ansible_connection: docker_api
|
||||
# docker_host: ssh://ed-c7-1.virt.magni.thoto.net
|
||||
|
Reference in New Issue
Block a user