{"action":"created","issue":{"url":"https://api.github.com/repos/contiv/cluster/issues/87","repository_url":"https://api.github.com/repos/contiv/cluster","labels_url":"https://api.github.com/repos/contiv/cluster/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/contiv/cluster/issues/87/comments","events_url":"https://api.github.com/repos/contiv/cluster/issues/87/events","html_url":"https://github.com/contiv/cluster/pull/87","id":148495340,"number":87,"title":"adding support for specifying host-group in extraVars","user":{"login":"vvb","id":4341190,"avatar_url":"https://avatars.githubusercontent.com/u/4341190?v=3","gravatar_id":"","url":"https://api.github.com/users/vvb","html_url":"https://github.com/vvb","followers_url":"https://api.github.com/users/vvb/followers","following_url":"https://api.github.com/users/vvb/following{/other_user}","gists_url":"https://api.github.com/users/vvb/gists{/gist_id}","starred_url":"https://api.github.com/users/vvb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vvb/subscriptions","organizations_url":"https://api.github.com/users/vvb/orgs","repos_url":"https://api.github.com/users/vvb/repos","events_url":"https://api.github.com/users/vvb/events{/privacy}","received_events_url":"https://api.github.com/users/vvb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-14T22:01:42Z","updated_at":"2016-04-14T23:28:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/contiv/cluster/pulls/87","html_url":"https://github.com/contiv/cluster/pull/87","diff_url":"https://github.com/contiv/cluster/pull/87.diff","patch_url":"https://github.com/contiv/cluster/pull/87.patch"},"body":"added support for specifying host-group as a part of extraVars.\r\nWe can now specify the below in extraVars,\r\n\r\n`\"contiv_role\": \"service-master\"`\r\n`\"contiv_role\": \"service-worker\"`\r\n\r\nIf an unrecognised role is passed, we ignore the role and continue with the previous(default) behaviour.\r\n\r\nThe following nodes were provisioned using the above logic, so we have 3 masters and 3 workers\r\n```\r\n            \"inventory-name\": \"ucsb-blade2-FCH1844JSV6\",\r\n            \"host-group\": \"service-master\",\r\n--\r\n            \"inventory-name\": \"ucsb-blade3-FLM19145KXV\",\r\n            \"host-group\": \"service-master\",\r\n--\r\n            \"inventory-name\": \"ucsb-blade4-FCH18517874\",\r\n            \"host-group\": \"service-master\",\r\n--\r\n            \"inventory-name\": \"ucsb-osd1-FCH1951V212\",\r\n            \"host-group\": \"service-worker\",\r\n--\r\n            \"inventory-name\": \"ucsb-osd2-FCH1951V0AV\",\r\n            \"host-group\": \"service-worker\",\r\n--\r\n            \"inventory-name\": \"ucsb-osd3-FCH1951V20Y\",\r\n            \"host-group\": \"service-worker\",\r\n```"},"comment":{"url":"https://api.github.com/repos/contiv/cluster/issues/comments/210201852","html_url":"https://github.com/contiv/cluster/pull/87#issuecomment-210201852","issue_url":"https://api.github.com/repos/contiv/cluster/issues/87","id":210201852,"user":{"login":"mapuri","id":9538438,"avatar_url":"https://avatars.githubusercontent.com/u/9538438?v=3","gravatar_id":"","url":"https://api.github.com/users/mapuri","html_url":"https://github.com/mapuri","followers_url":"https://api.github.com/users/mapuri/followers","following_url":"https://api.github.com/users/mapuri/following{/other_user}","gists_url":"https://api.github.com/users/mapuri/gists{/gist_id}","starred_url":"https://api.github.com/users/mapuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapuri/subscriptions","organizations_url":"https://api.github.com/users/mapuri/orgs","repos_url":"https://api.github.com/users/mapuri/repos","events_url":"https://api.github.com/users/mapuri/events{/privacy}","received_events_url":"https://api.github.com/users/mapuri/received_events","type":"User","site_admin":false},"created_at":"2016-04-14T23:28:13Z","updated_at":"2016-04-14T23:28:13Z","body":"@vvb \r\n\r\nI don't like the idea of passing node's role in extra-vars as it overloads the function of `extra-vars`. `extra-vars` shall be transparently passed as ansible variables and not interpreted by cluster manager. \r\n\r\n`node's role` on the other hand needs special consideration from cluster manager. Like we may need to make role election dynamic. We already do some checks while node decommission to make sure last master node is not brought down while there are active workers.\r\n\r\nI think we should introduce a flag say `--role` (or `--host-group`) to `commission` command, with following behavior:\r\n- It will be a mandatory flag in first introduction with two possible values viz. `service-master` and `service-worker`\r\n  - Or it can default to `service-worker` when not specified. But this would mean that there is a chance that user will end up configuring a lot of nodes as `service-worker`. I would prefer avoiding this though and warn user early on by making this flag mandatory and let them make a informed decision.\r\n - Also later it leaves room to set the flag's default to `auto` or something, when and if we decide to make role election automatic inside cluster-manager.\r\n\r\nOther things:\r\n- We will need appropriate updates to the REST endpoint for node `commission`\r\n- We will need to ensure that first node being commissioned is a master. Or a more better test would be that there is at least one commissioned master that is also online (in `Discovered` state) when a worker is being commissioned.\r\n- also we need to add system tests for this feature, at the least:\r\n  - testing the role gets assigned as expected\r\n  - testing special scenarios, like configuring worker before any master; worker with offline master and so on"}}