{"action":"created","issue":{"url":"https://api.github.com/repos/openshift/openshift-ansible/issues/1081","labels_url":"https://api.github.com/repos/openshift/openshift-ansible/issues/1081/labels{/name}","comments_url":"https://api.github.com/repos/openshift/openshift-ansible/issues/1081/comments","events_url":"https://api.github.com/repos/openshift/openshift-ansible/issues/1081/events","html_url":"https://github.com/openshift/openshift-ansible/pull/1081","id":122609287,"number":1081,"title":"Refactors Docker setup to own role to avoid race in SDN setup","user":{"login":"EricMountain-1A","id":8555225,"avatar_url":"https://avatars.githubusercontent.com/u/8555225?v=3","gravatar_id":"","url":"https://api.github.com/users/EricMountain-1A","html_url":"https://github.com/EricMountain-1A","followers_url":"https://api.github.com/users/EricMountain-1A/followers","following_url":"https://api.github.com/users/EricMountain-1A/following{/other_user}","gists_url":"https://api.github.com/users/EricMountain-1A/gists{/gist_id}","starred_url":"https://api.github.com/users/EricMountain-1A/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EricMountain-1A/subscriptions","organizations_url":"https://api.github.com/users/EricMountain-1A/orgs","repos_url":"https://api.github.com/users/EricMountain-1A/repos","events_url":"https://api.github.com/users/EricMountain-1A/events{/privacy}","received_events_url":"https://api.github.com/users/EricMountain-1A/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-16T21:43:46Z","updated_at":"2015-12-16T22:25:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/openshift/openshift-ansible/pulls/1081","html_url":"https://github.com/openshift/openshift-ansible/pull/1081","diff_url":"https://github.com/openshift/openshift-ansible/pull/1081.diff","patch_url":"https://github.com/openshift/openshift-ansible/pull/1081.patch"},"body":"Refactors Docker setup to its own role to avoid race between start/stop and SDN setup that also restarts Docker.\r\n\r\nWhat o-a does:\r\n\r\n* docker role\r\n    * tasks start docker\r\n    * handler restarts docker and udevd\r\n* openshift_node role\r\n    * tasks start node\r\n    * handler:\r\n        * restarts node (if wasn't started by tasks, per #1057)\r\n        * restarts docker\r\n\r\nopenshift-node runs openshift-sdn-kube-subnet-setup.sh on startup.  Amongst other things it:\r\n\r\n* runs systemctl daemon-reload\r\n* restarts docker\r\n\r\nThe docker restart above races with the one in the openshift_node role's handler, leading to the setup script exiting prematurely due to systemctl cancelling conflicting jobs relating to intertwined docker start/stop actions:\r\n\r\n```\r\n[root@192 ~]# journalctl | grep -E \"Docker Application|ansible-service|Starting OpenShift|Output of setup script|Job for\"\r\nDec 16 08:52:07 acs-e2e-test-eric-10340-node-compute-0.novalocal ansible-service[10372]: Invoked with name=iptables pattern=None enabled=True state=started sleep=None arguments= runlevel=default\r\nDec 16 08:52:37 192.168.243.4 ansible-service[11531]: Invoked with name=docker pattern=None enabled=True state=started sleep=None arguments= runlevel=default\r\nDec 16 08:52:37 192.168.243.4 systemd[1]: Starting Docker Application Container Engine...\r\nDec 16 08:52:37 192.168.243.4 systemd[1]: Started Docker Application Container Engine.\r\nDec 16 08:52:49 192.168.243.4 ansible-service[12281]: Invoked with name=openshift-node pattern=None enabled=True state=started sleep=None arguments= runlevel=default\r\nDec 16 08:52:49 192.168.243.4 systemd[1]: Starting OpenShift Node...\r\nDec 16 08:52:52 192.168.243.4 systemd[1]: Stopping Docker Application Container Engine...\r\nDec 16 08:52:52 192.168.243.4 ansible-service[12576]: Invoked with name=docker pattern=None enabled=None state=restarted sleep=None arguments= runlevel=default\r\nDec 16 08:52:52 192.168.243.4 systemd[1]: Starting Docker Application Container Engine...\r\nDec 16 08:52:52 192.168.243.4 openshift-node[12348]: I1216 08:52:52.371431   12348 kube.go:29] Output of setup script:\r\nDec 16 08:52:52 192.168.243.4 openshift-node[12348]: Job for docker.service canceled.\r\nDec 16 08:52:52 192.168.243.4 systemd[1]: Stopped Docker Application Container Engine.\r\nDec 16 08:52:52 192.168.243.4 openshift-node[12348]: Job for docker.service canceled.\r\nDec 16 08:52:52 192.168.243.4 systemd[1]: Starting Docker Application Container Engine...\r\nDec 16 08:52:52 192.168.243.4 systemd[1]: Started Docker Application Container Engine.\r\nDec 16 08:52:52 192.168.243.4 systemd[1]: Starting OpenShift Node...\r\nDec 16 08:52:53 192.168.243.4 openshift-node[12711]: I1216 08:52:53.138953   12711 kube.go:29] Output of setup script:\r\n```\r\n\r\nOn the 2nd start of openshift-node, the setup script aborts claiming nothing needs to be done.\r\n\r\nOther folks are seeing this too it seems - c.f. #780.\r\n\r\nObjective of this PR is to refactor the docker config that is done in the openshift_node role, to the docker role.  This should eliminate the race.\r\n\r\nWith this patch:\r\n\r\n```\r\nopenshift@eric-node-compute-8048a ~]$ sudo journalctl | grep -E \"Docker Application|ansible-service|Starting OpenShift|Output of setup script|Job for\"\r\nDec 16 16:01:38 eric-node-compute-8048a.example.com ansible-service[11134]: Invoked with name=iptables pattern=None enabled=True state=started sleep=None arguments= runlevel=default\r\nDec 16 16:01:55 eric-node-compute-8048a.example.com ansible-service[12383]: Invoked with name=docker pattern=None enabled=True state=started sleep=None arguments= runlevel=default\r\nDec 16 16:01:55 eric-node-compute-8048a.example.com systemd[1]: Starting Docker Application Container Engine...\r\nDec 16 16:01:56 eric-node-compute-8048a.example.com systemd[1]: Started Docker Application Container Engine.\r\nDec 16 16:01:59 eric-node-compute-8048a.example.com ansible-service[13051]: Invoked with name=openshift-node pattern=None enabled=True state=started sleep=None arguments= runlevel=default\r\nDec 16 16:02:00 eric-node-compute-8048a.example.com systemd[1]: Starting OpenShift Node...\r\nDec 16 16:02:03 eric-node-compute-8048a.example.com systemd[1]: Stopping Docker Application Container Engine...\r\nDec 16 16:02:03 eric-node-compute-8048a.example.com systemd[1]: Starting Docker Application Container Engine...\r\nDec 16 16:02:04 eric-node-compute-8048a.example.com systemd[1]: Started Docker Application Container Engine.\r\nDec 16 16:02:04 eric-node-compute-8048a.example.com openshift-node[13118]: I1216 16:02:04.092320   13118 kube.go:29] Output of setup script:\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/openshift/openshift-ansible/issues/comments/165273245","html_url":"https://github.com/openshift/openshift-ansible/pull/1081#issuecomment-165273245","issue_url":"https://api.github.com/repos/openshift/openshift-ansible/issues/1081","id":165273245,"user":{"login":"detiber","id":915544,"avatar_url":"https://avatars.githubusercontent.com/u/915544?v=3","gravatar_id":"","url":"https://api.github.com/users/detiber","html_url":"https://github.com/detiber","followers_url":"https://api.github.com/users/detiber/followers","following_url":"https://api.github.com/users/detiber/following{/other_user}","gists_url":"https://api.github.com/users/detiber/gists{/gist_id}","starred_url":"https://api.github.com/users/detiber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/detiber/subscriptions","organizations_url":"https://api.github.com/users/detiber/orgs","repos_url":"https://api.github.com/users/detiber/repos","events_url":"https://api.github.com/users/detiber/events{/privacy}","received_events_url":"https://api.github.com/users/detiber/received_events","type":"User","site_admin":false},"created_at":"2015-12-16T22:25:25Z","updated_at":"2015-12-16T22:25:25Z","body":"@EricMountain-1A thanks for digging into this issue! In general I really like conceptual changes, I'd just like to see the docker role avoid any openshift specific dependencies.\r\n\r\n@sdodson I believe your containerization changes included moving some changes similar to this as well."}}