diff --git a/examples/check_deployment.sh b/examples/check_deployment.sh index ece1a7e6..fcab924a 100755 --- a/examples/check_deployment.sh +++ b/examples/check_deployment.sh @@ -1,4 +1,4 @@ #!/bin/bash -docker exec -it keystone-test keystone --debug --os-username admin --os-password password --os-tenant-name admin --os-auth-url http://10.0.0.3:8080/v2.0 role-list +docker exec -it solar.keystone-test keystone --debug --os-username admin --os-password password --os-tenant-name admin --os-auth-url http://10.0.0.3:8080/v2.0 role-list diff --git a/examples/resources/containers.yml b/examples/resources/containers.yml new file mode 100644 index 00000000..c678fdad --- /dev/null +++ b/examples/resources/containers.yml @@ -0,0 +1,13 @@ +id: containers +class: containers +type: resource +handler: ansible +version: v1 + +actions: + ensure: simple/containers/ensure.yml + clean_list: simple/containers/clean_list.yml + +input: {} + +tags: [service/containers] diff --git a/examples/resources/haproxy.yml b/examples/resources/haproxy.yml index c77b3572..2e2570b8 100644 --- a/examples/resources/haproxy.yml +++ b/examples/resources/haproxy.yml @@ -9,7 +9,7 @@ actions: remove: simple/haproxy/remove.yml input: - name: haproxy-test + name: solar.haproxy-test image: 'haproxy:1.5' services: diff --git a/examples/resources/keystone.yml b/examples/resources/keystone.yml index 4ff21b47..d7a6eeaf 100644 --- a/examples/resources/keystone.yml +++ b/examples/resources/keystone.yml @@ -17,7 +17,7 @@ input: item: '{{ item.node.ip }}' admin_port: 35357 public_port: 5000 - name: keystone-test + name: solar.keystone-test image: kollaglue/centos-rdo-keystone tags: [service/keystone] diff --git a/examples/resources/mariadb.yml b/examples/resources/mariadb.yml index 0826b278..4bf59c49 100644 --- a/examples/resources/mariadb.yml +++ b/examples/resources/mariadb.yml @@ -12,7 +12,7 @@ actions: input: bind_ip: "{{ this.node.ip }}" - name: mariadb-test + name: solar.mariadb-test image: kollaglue/fedora-rdo-mariadb-app root_password: test1 users: diff --git a/examples/resources/simple/containers/clean_list.yml b/examples/resources/simple/containers/clean_list.yml new file mode 100644 index 00000000..dbb12ab9 --- /dev/null +++ b/examples/resources/simple/containers/clean_list.yml @@ -0,0 +1,6 @@ + +- hosts: [service/containers] + sudo: yes + tasks: + - file: state=directory path=/var/lib/solar/ + - shell: echo -n "" > /var/lib/solar/containers_list diff --git a/examples/resources/simple/containers/ensure.yml b/examples/resources/simple/containers/ensure.yml new file mode 100644 index 00000000..26a903f8 --- /dev/null +++ b/examples/resources/simple/containers/ensure.yml @@ -0,0 +1,9 @@ + +- hosts: [service/containers] + sudo: yes + tasks: + - shell: docker ps -a | egrep -v "CONTAINER ID|$(cat /var/lib/solar/containers_list | tr '\n' '|' | sed 's/|$//')" | egrep 'solar\.' | awk '{print $1}' + register: containers + + - shell: docker rm -f {{item}} + with_items: containers.stdout_lines diff --git a/examples/resources/simple/haproxy/run.yml b/examples/resources/simple/haproxy/run.yml index 6d01b7dc..fff9c7bb 100644 --- a/examples/resources/simple/haproxy/run.yml +++ b/examples/resources/simple/haproxy/run.yml @@ -2,6 +2,8 @@ - hosts: [service/haproxy] sudo: yes tasks: + - shell: echo {{name}} >> /var/lib/solar/containers_list + - shell: docker ps | grep -q {{name}} ignore_errors: true register: is_running diff --git a/examples/resources/simple/keystone/run.yml b/examples/resources/simple/keystone/run.yml index b221da7b..9f4e6778 100644 --- a/examples/resources/simple/keystone/run.yml +++ b/examples/resources/simple/keystone/run.yml @@ -2,6 +2,8 @@ - hosts: [service/keystone] sudo: yes tasks: + - shell: echo {{name}} >> /var/lib/solar/containers_list + - shell: docker ps | grep -q {{name}} ignore_errors: true register: is_running diff --git a/examples/resources/simple/mariadb/run.yml b/examples/resources/simple/mariadb/run.yml index 650b0f5a..4d3f443d 100644 --- a/examples/resources/simple/mariadb/run.yml +++ b/examples/resources/simple/mariadb/run.yml @@ -2,6 +2,7 @@ - hosts: [service/mariadb] sudo: yes tasks: + - shell: echo {{name}} >> /var/lib/solar/containers_list - shell: docker ps | grep -q {{name}} ignore_errors: true register: is_running